|
Galadriel Fouquet
Registered User
Join date: 11 Jul 2006
Posts: 18
|
10-02-2006 14:18
Okay I am in a little bit of a quandry. Given two position vectors. PosA and PosB, I need to find the 4 float rotation needed to rez an object that goes from PosA to PosB
Here is what I have.... it is not working
person=(llDetectedPos(i)); llSay(0, "Targeting " + llDetectedName(i) + " at " + (string)person); llLookAt(person, 32727, 32727); cnt=0; eul= ((llGetPos()) - person); eul *= DEG_TO_RAD; //convert to radians vector b = llGetPos(); rotation a = llEuler2Rot(eul); vector c = llRot2Fwd(a); vector d = llRot2Up(a); b += c; b += d * 1; c *= 65; do { cnt++; //llSay(0,(string)cnt); llRezObject("NewBB", b, c, a, 0); } while (cnt < 3);
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
10-02-2006 14:56
LSL has that built in: llRotBetween()
|
|
Galadriel Fouquet
Registered User
Join date: 11 Jul 2006
Posts: 18
|
10-02-2006 17:51
Maybe I should have been more detailed.
I need to rez object going from GetLocalPos() to llDetectedPos(i)....
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
10-03-2006 09:03
Do you mean, like... rez a prim oriented to the angle of travel, and scaled so that the faces of the prim meet both points?
Or is this just a bullet, and you need the bullet pushed toward point B from point A?
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
10-03-2006 09:18
From: Galadriel Fouquet Maybe I should have been more detailed.
I need to rez object going from GetLocalPos() to llDetectedPos(i).... rotation vector2rot( vector Vector ) {
vector forward = llVecNorm( Vector ); vector left; if( (forward.z > 0.9999) || (forward.z < -0.9999) ) { left = llVecNorm( <1.0, 0.0, 0.0> % forward ); } else { left = llVecNorm( <0.0, 0.0, 1.0> % forward ); }
return llAxes2Rot( forward, left, llVecNorm( forward % left ) ); }
returned rotation will make the X+ side of object 'aim' in the direction of provided vector, if i recall right. If the rezzing object is rotated, you might need to cancel it out through dividing the provided rotation by rotation of rezzing 'parent' object.
|