Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-08-2008 08:46
I am trying to get a motorbike, when I have finished playing on it, to jump up onto a trailer and have end up the right way up and facing in the same direction as the trailer. It works fine having the trailer send the bike its position and rotation, and then having the bike use llSetPos and llSetRot to move into place, but only if the bike and the trailer are constructed so their root prims are orientated the same way (that is, if I look at the two builds in edit with with the local rather than world view activated, the arrows point in the same way for both).
How do I get the bike to align itself correctly if the trailer isn't thus constructed and if the trailer has moved since I took the bike off it? Ideally, I would like to get it to correct itself automatically, but I can't even figure out how to tell it turn through 90 degrees so it's upright rather than on its side and then turn 90 degrees clockwise so it's facing the right way.
Can anyone assist me? I think part of the problem, when I am trying to turn it round, is I don't understand whether I'm supposed to be using world or local axes.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
10-08-2008 12:12
you need one extra application of rotation...
to do this you'll want to place the trailer with it's root set to zero rotation
then place the bike where it needs to be in relation to the trailer and get it's rotation (doesn't matter if the root prim is aligned or not) and save this for later
now, when you get the trailers rotaton, instead of applying it directly to the bike (like you did when they both had root prims in alignment) you take the saved rotation and multiply it by the trailers current rotation, which will give you the rotation you want to use
note that order is important, you want saved * current and note the reverse, which will be all kinds of wrong
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-08-2008 12:43
Thank you so much, Void... works like a charm.
|