|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
10-18-2007 18:40
I was wondering if anyone could give me a hand on this.
I have a vehicle that is given a position vector and I am going to move the vehicle to that vector with llMoveToTarget(). However, instead of moving exactly to that vector, I want to pull up alongside it such that it is 2 meters to my left.
Any ideas?
|
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
10-19-2007 06:24
Taking the cross-product (%) of the vector pointing from your vehicle to its destination and the vector of the z-axis (although I forget which needs to be in front, right-hand rule anyone?  ) will give you a vector pointing to the 'left' of the object, normalize that result with llVecNorm and multiply it by 2.0, then add it to the original destination, and you'll be 2 meters to the 'left.' Here is an example of the right-hand rule: 
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
10-19-2007 18:58
Thanks, Tyken, I'll give that a shot.
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
10-21-2007 14:49
Ok, so I am trying this but am having a hard time breaking it down.
>>Taking the cross-product (%) of the vector pointing from your vehicle to its destination...>>
What exactly would be the vector pointing from my vehicle to its destination? Right before moving I do have the vehicle pointing at the destination. So would it be llGetRot()? Or llGetPos()? Or something else?
>>...and the vector of the z-axis (although I forget which needs to be in front, right-hand rule anyone?>>
Pretty much the same question here. What Z-axis are we talking about - the vehicle's or the destination's? And how do I get its vector?
The last three steps about normalizing, multiplying by 2 and finally adding to the original destination all make sense. But the two parts that need to be cross producted are losing me.
|
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
10-21-2007 17:02
From: Lemieux Primeau What exactly would be the vector pointing from my vehicle to its destination? Right before moving I do have the vehicle pointing at the destination. So would it be llGetRot()? Or llGetPos()? Or something else?
What you do here is subtract the current position's coordinate vector from the destination's, vector direction = destination - llGetPos(), and this gives you the vector direction from you to your destination. From: someone >>...and the vector of the z-axis (although I forget which needs to be in front, right-hand rule anyone?>>
Pretty much the same question here. What Z-axis are we talking about - the vehicle's or the destination's? And how do I get its vector?
The z-axis is just the global z-axis, <0.0, 0.0, 1.0>. So it should be the cross product of this by the vector we got from the last operation, <0.0, 0.0, 1.0> % direction.
|
|
Lemieux Primeau
Registered User
Join date: 25 Oct 2006
Posts: 49
|
10-21-2007 18:11
Awesome, thanks Tyken - trying it now...
|