Jump to content

LLRotLookAt() & child prims


Iva Rhapsody
 Share

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

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

Recommended Posts

I have made a coral head and am trying to get a linked prim to follow a predefined path, pointing it's neg y axis towards the next waypoint, this chunk of code worked for a physical, non-linked version but the rotations aren't working properly, I assume I have to offset the recorded local rots by the root prims rotation but haven't been able to make it work...

both target & pos are local positions

 llRotLookAt( llRotBetween( <0.0,-1.0,0.0>, llVecNorm( <target.x,target.y,pos.z> - pos)) , 1.0, .4);

Link to comment
Share on other sites

Have you tried this with -1.0 on the x and z axies?

 

The one thing is when your making the build you have scripted you need to have edited linked prims in so you can fix it while its linked to your object your making. Then after trying a couple of times it should work okay if you place the scripts in the right spots to the root prim.

Link to comment
Share on other sites

Your variable pos should be llGetPos()+ pos*llGetRot() .  The local pos is an offset from your object's root prim to the child prim, but what you want to calculate is the angle between there and the target position, which has to be a global position.  Adding that offset to the root prim's global position and correcting for the root's rotation makes your child prim's position global as well.  llRotLookAt essentially applies your calculated angle each time it updates as if you had written llSetLocalRot .  You could also use Void Singer's code snippet uSteppedRotLookAt at https://wiki.secondlife.com/wiki/LlRotLookAt to do the same thing.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4214 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...