Jump to content

How do I point a physical follower's y axis the way I want it?


Innula Zenovka
 Share

You are about to reply to a thread that has been inactive for 4782 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I've got a sculpted prim, a heart, which has the heart's flat faces on the Y axis.   

If I'm making a physical follower with it, that floats over my target's head, how do I get a flat face pointing the same way my avatar is looking?   I get very confused by llRotLookAt, I'm afraid .. I don't really understand what the wiki's explanation that it causes the "object to point its forward axis towards target" means when target is a rotation, let alone what rotation I need to be calculating in this context.   

The position at which I want to point my prim's x axis, I think, is a point at <targetPos.x, (targetPos.y +1.0),myPos.z>*targetRot.   But, assuming that's right, I'm really not sure how I do that with physics movements.

Link to comment
Share on other sites

I'm asuming the -Z axis is the same as the "point" on the heart?

llEuler2Rot( <0.0, 0.0, 90.0> * DEG_TO_RAD ) * vRotAvatar;

or more compactly,

<0.0, 0.0, 0.7071067, 0.7071067> * vRotAvatar

 

the singe axis formula for rotation is
X,Y, or Z = sin( degrees / 2 ), and the unused two are set to 0.0.
S = cos( degrees / 2 )

Link to comment
Share on other sites

I agree about the wiki on this one, Innula. The description for llRotLookAt is hard to understand.  How can a rotation be a target? Clearly "target" doesn't mean "the direction I want my object to face", because you'd use llSetRot for that. If it's "the direction that some target object is facing", then you'd need some way to identify the target object (Besides, you'd use llSetRot(llDetectedRot(0) or some such ...).  I have avoided using llRotLookAt because I have never been able to figure it out.  I suspect that it's useful, though.

Link to comment
Share on other sites

<p> the "target" is the frame relative (could be region for object roots, could be the root for child prims) direction you want the prim to face... for instance "north", so it's definitely counter intuitive for any use where you want it to track another object (because you first have to figure out what direction that object is from the prim that's calling it.</p>

Link to comment
Share on other sites

Oh, I see.   I think.  As is so often the case, these things seem a lot simpler after you explain them, Void.

Am I right in thinking, then, that, at its simplest, the "target" rotation llRotLookAt wants, if I want to point the prim's positive x axis towards a position on the sim, is something like

 

llRotBetween(<1,0,0>,llVecNorm(targetPosition - llGetPos()));

 

 

Link to comment
Share on other sites

Ah...!!!  That doesn't look like anything I would call a target, but I see what it's doing. Thank you for the example, Innula, and Void for the context.  I'll still need to play with this a bit before I'm comfortable, but it helps a lot.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4782 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...