So I have a target, how do I get my AV to turn to face the target vector?
The object with the script is one im holding, i just want it to make me turn to face target...
llLookAt seems to just make me sink into the ground to my knees....
These forums are CLOSED. Please visit the new forums HERE
How to make AV turn to Vector? |
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
08-17-2004 18:34
So I have a target, how do I get my AV to turn to face the target vector?
The object with the script is one im holding, i just want it to make me turn to face target... llLookAt seems to just make me sink into the ground to my knees.... |
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
08-17-2004 22:06
You might be able to llApplyRotationalImpulse to turn the avatar, but it will only work if the turn is around the Z axis. Im afraid I cant help you with a significant portion of the math involved with this.
There is a problem with attached objects that initiate damped motion. That skinking-broken-legs animation your avatar goes into is the symptom. llLookAt doesnt work because it requires that the object be capable of rotating along all axes, the avatar is like an object who's capability to rotate around the X or Y axes has been disabled. Also, llLookAt, if it had worked, would've pointed the avatar's head at the target. ![]() This function may be of use to you: CODE
getRotToPointAxisAt(vector axis, vector target) returns the rotation necessesary for the object to point axis at target. The axis that corresponds to the direction the avatar is facing is known as the forward axis. The vector representing that is declared as a global constant in that snippet, named "AXIS_FWD". Pass that axis to getRotToPointAxisAt, along with your target position, to get the rotation you're looking for. The math I cant help you with is the conversion between this rotation and the impulse vector you need to pass to llApplyRotationalImpulse. Good luck! ==Chris _____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
08-17-2004 22:53
If you're going to have to apply llRotationalImpulse you're probably best off resorting to trig since, as Chris says, converting from a rot into an angle about the z-axis isnt really easy-peasy. I mean it might be, but trig is easy too.
The trig is: CODE
Note this is pseudo-code, ie you'll have to check the real names of llAcos, llSqrt etc, and -= += dont exist in LSL ( I think?). Azelda _____________________
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
08-17-2004 23:56
Still no good, and too many hours today frustrated over this.
Could someone please post a script that does the following.... Assuming script in Content of object in hand of AV. Make AV1 rotate to face AV2, either on touch, or result of listen to get AV2 name. The below code, on the holding avatar saying: /1 open <AVATAR NAME> Will properly interpret the avatar name. Now I need to make the AV1 (holding the object) turn to face AV2, and move towards them as well. But the turning is the part thats kicking my butt. Will donate to the person who can help solve this, time is Linden after all. Working code is: CODE
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
08-18-2004 00:32
Have you tried llRotLookAt? Pass the return value of getRotToPointAxisAt(AXIS_FWD, llDetectedPos(n)) to llRotLookAt, and see what happens.
Heck, it just might work. |
Catherine Omega
Geometry Ninja
![]() Join date: 10 Jan 2003
Posts: 2,053
|
08-18-2004 00:52
Okay, I tried a few things and my verdict is that you can't turn the avatar through an attachment. Sorry.
_____________________
|
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
08-18-2004 00:59
Catherine, is that because you cant apply a rotational impulse from an attachment or because you cant apply a rotational impulse to an avatar?
If its the first one, it would be possible to rez a drone object that does the actual turning. Azelda _____________________
|
Catherine Omega
Geometry Ninja
![]() Join date: 10 Jan 2003
Posts: 2,053
|
08-18-2004 01:17
Well, while I haven't actually tested it using the drone method, as it didn't occur to me to try it, it seems pretty likely that it wouldn't work either. It could be worth a try if anyone wants to bother, but I'm pretty confident that you can't turn an avatar.
_____________________
|
Hiro Pendragon
bye bye f0rums!
![]() Join date: 22 Jan 2004
Posts: 5,905
|
08-18-2004 01:29
Easy. Rez naked pictures of Janet Reno all around a person except in the direction you want them to face.
|
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
|
08-18-2004 08:49
Im just starting to script here, but Im a very experienced coder, and it seems silly that we cannot affect the primary AV movement through script.
My intent was to do a /1 hug <name> and the object listening to /1 would sensor <name> and turn you to face them and move you to within range. I understand and appreciate permissions, but permissions granted, I cant affect my own AV with script? There just seems to be a lot of functions missing that should be in LSL to support the game. Is anyone actively working on giving us new functions? I had an easier time coding for Neverwinter Nights when I made HCR for it, at least then i could move a player around or teleport them somewhere if i needed to. |
Wraith Jensen
I can walk thru walls....
![]() Join date: 8 Aug 2004
Posts: 130
|
08-18-2004 08:59
Arch: you CAN affect avatar positions and animations, but only while sitting on an object. To get away from *looking* like you're sitting on an object, change the animation to something that's not a sit.
Hugs (and other personal interactions) can be done. They usually involve "sitting" on a scripted object. The object sets up relative sit positions, and then triggers an animation for the preferred action. I have a couple of hug animations, they were freely, given to me, so if you'd like, I can give them to you. Thinking about it, what you might be able to do is this: have your worn object rez a small sphere with the text set to "right-click to give me a hug!". Also set a timer event that destroys the object after a couple of minutes. Of course, that only works on land where you can rez objects. _____________________
|
Catherine Omega
Geometry Ninja
![]() Join date: 10 Jan 2003
Posts: 2,053
|
08-18-2004 10:39
Yes, Archaegeo, it's very silly. You should bug the Lindens about it.
![]() _____________________
|
Jeffrey Gomez
Cubed™
![]() Join date: 11 Jun 2004
Posts: 3,522
|
08-20-2004 02:06
If I might suggest... smart useage of llPushObject on an avatar can more or less achieve this result. The "trick" involved would probably involve spawning a "follower" on the original player to nudge him in the right direction (since attachment push is pretty weak), but...
It's the dead of the morning, and I honestly don't feel like writing this right now (especially with such fine scripters already on this thread *hint*), but I'm sure you folks can probably come up with something (*hint*). After all, one fun feature with push is, while it won't exactly turn the camera, it tends to automatically make an avatar turn to maintain running momentum... (I would test this, however) and will achieve desired movement as well. All you really need to do is calculate the direction to your target. Just don't add too many zeros. I've easily ended up at 50,000 feet doing similar with llSetTorque. ![]() |
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
|
08-20-2004 07:55
More insensible hacks. We may not be able to rotate a player. But couldn't he res an object under the player. Move that object up till players z position changes. (ie player is standing on object) and then rotate the object ?
nm I just realized this wouldn't work if their flying. btw I have an object that fallow a player. At specified rotation, at a specified distance, at a specified hight offset, It trigger animations on the sitter, and the player it's following. The problem I've found with following objects, is that there isn't a way to set a player as phantom. But maybe it's possible to get the visible model and the collision model in different places through the use of avatar animation. I've been trying to test this out, but I can't get any of my animations to export. :| |
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
|
08-20-2004 08:30
Ok, adding to the idea of turning the avatar on a platform: I was playing with Debug mode yesterday and noticed that our avatars have a pretty detailed skeleton built specifically for collision purposes.
So... if the player is flying, chances are his/her arms are up in the air by their sides, sticking out, and a couple of poles rezed appropriately could be used to turn them, by pushing on their arms. Not tested this at all. I'll be frankly surprised if it works, but y'never know... Azelda _____________________
|
Catherine Omega
Geometry Ninja
![]() Join date: 10 Jan 2003
Posts: 2,053
|
08-20-2004 14:51
The physics doesn't work on the avatar like that, Azelda. It only sees it as a bounding box.
_____________________
|
Francis Chung
This sentence no verb.
![]() Join date: 22 Sep 2003
Posts: 918
|
08-20-2004 17:00
Hi Archaegeo,
Sorry for the late reply, I just saw this thread. I'm the one who wrote the script I think you're trying to copy. At any rate, there's no way to rotate an avatar from an attachment. I've tried them all. If it was possible, I'd have done it. I documented this on the wiki some months ago. Let me know if you find a work-around. _____________________
--
~If you lived here, you would be home by now~ |