|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
06-01-2008 07:38
I hate rotations! I can't seem to find an example that does what I'm trying to do and despite reading the wiki, I don't understand rotations enough to figure this out on my own.
I rez an object 1 m to the right of the AV, who could be pointed in any direction. That part works correctly. The object of course rezzes at its own orientation. I want to rotate the object to face in the same direction as the AV, AFTER it is rezzed (I know I could set the rotation at rezzing, but I don't want to do this in this case).
I am wearing a HUD that will whisper the orientation of the AV to the object to be rotated. The HUD uses llGetRot() to get the current orientation of the AV. The object hears the AV's orientation and stores it in AVRot.
Now I would have thought that just executing llSetRot(AVRot) in the object would have set the rotation as desired. But it doesn't do that. I'm thinking that I may have to correct for the orientation of the vector between the AV and the object but I don't understand how to do that.
Could someone please point me in the right direction?
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
06-01-2008 08:42
Something here may help: 
|
|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
06-01-2008 09:18
Thanks, but I still don't get it. The example uses llGetRot in the HUD to find the AV's rotation and to set the object to the same rotation of the object. I am doing the same thing, but it is not working for me. The example is more about the position of the rezzed object. I'm getting the position where I want it, just not the rotation.
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
06-01-2008 09:23
Monica, your logic seems sound to me (not an expert).
If you set the object to ZERO_ROTATION, does it point East? Is left North, and up Up? Maybe the root prim of the object being rezzed is not normalized.
When you whisper the rotation to the object, what orientation does it rotate too?
lee
_____________________
So many monkeys, so little Shakespeare.
|
|
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
|
06-01-2008 10:16
This seems to work for me: // Rezzer default { touch_start(integer total_number) { llRezObject("Object", llGetPos() + (<0.0, -1.0, 0.0 > * llGetRot()), ZERO_VECTOR, ZERO_ROTATION, 0); llSay(1, (string)llGetRot()); } }
// Rezzee default { state_entry() { llListen(1, "", "", ""); }
listen(integer channel, string name, key id, string message) { if(llGetOwnerKey(id) == llGetOwner()) llSetRot((rotation)message); } }
|
|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
06-01-2008 17:19
Thanks Pale. You at least confirmed that I was not a total dummy. You are correct. The only thing that was messing me up was the unexpected return value of llGetRot from the HUD. I was expecting that if the AV was facing east (toward x=0), that would be the direction of zero rotation. In fact, that direction is rotated 180 degrees. If I correct for that and use rotation rot = llGetRot() * llEuler2Rot(<0.0,0.0,180.0> * DEG_TO_RAD) as my rotation, setting the rezee object to that rotation results in the object consistently facing in the same direction as the AV.
|