Jump to content
Sign in to follow this  
Iva Rhapsody

LLRotLookAt() & child prims

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);

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...