Jump to content
Sign in to follow this  
Iva Rhapsody

Making an object point towards another AND move in that direction

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

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

Recommended Posts

I am trying to cause a linkset to point at a target object and then go to it..I was able to get it to point properly using

Point2Object( key UUID )
{
        vector a = llList2Vector(llGetObjectDetails(UUID, ([OBJECT_POS])),0);
        llSetRot(llRotBetween(<0,0,-1>,llVecNorm(a - llGetPos())));    
}

which worked fine, then I added code using llMoveToTarget, it moves towards the target just fine but doing this defeats the point @ function above for some reason..it's orientation stays the same regardless of the targets position.

 

state fly
{
    state_entry()
    {
        Point2Object( target );
        llMoveToTarget(target_pos,0.4);
        llSetTimerEvent(.1);
    }
    timer()
    {
        animate();
        Point2Object( target );
    }
    
    at_target(integer tnum, vector targetpos, vector ourpos)
    {
        llTargetRemove( target_id );
        GetTarget();
        state hover;
    }   
}

 Any ideas ?

 

Share this post


Link to post
Share on other sites

Without knowing what's in the animate() code it's difficult to say for sure, but I suspect part of the problem may be that llSetRot() doesn't work with physical objects, which the object must be for llMoveToTarget to do anything.

Try with llRotLookAt instead.

Share this post


Link to post
Share on other sites

Try something like

	vector a = llList2Vector(llGetObjectDetails(UUID, ([OBJECT_POS])),0);		vector pos = llGetPos();		llRotLookAt(llRotBetween(<0,0,-1>,llVecNorm(<a.x,a.y,pos.z> - pos)));

 which should have it swivel round left to right, and back, on its z axis, while staying upright.

Share this post


Link to post
Share on other sites

Thanx everyone I have everything working just fine, but I want to mention that despite what others may say..size DOES matter.

 

I rebuilt my dragonflies orienting all prims x forward and z up and incorporated your suggestions and viola!, however when i used the same link set as a template, simply resizing a few prims, dropping in different sculpt textures and retexturing to make my butterflies they refused to turn to point at the target, after trying everything I could think of i stretched the linkset a bit & it worked!..I then dropped my skirt resizer into the root and nudged it up step by step till the script would function properly..I suspect there is a physics engine limit to the smallest prim you can incorporate into the set so if all else fails you may have to bump up the size or use nanoprims since I'm sure it's the size of the bounding box, not the sculpted prims apparent size that counts.

anyway my butterflies are slightly larger than life, but what isn't in sl lol.

 

Thanks again

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3281 days.

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

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...