Jump to content

My animesh critter won't look at me


Innula Zenovka
 Share

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

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

Recommended Posts

and I can't understand why.

The animesh NPC calls llWanderWithin.    While it's wandering, something happens to attract its attention, and I want it to stop and look at whatever that might be.

This should do the trick, I would have thought, and it does stop it, start the stand animation and gives the expected debug message with the correct rotation, but it refuses to turn.

faceTarget(key id){
    kTarget = id;
    llExecCharacterCmd(CHARACTER_CMD_SMOOTH_STOP, []);
    lTemp = llGetObjectDetails(kTarget, [OBJECT_POS,OBJECT_ROT]);
    playObjectAnim(strStandAnim);//simple userfunction to start new anim and stop old one

    vTargetPos = llList2Vector(lTemp, 0);
    rTargetRot = llList2Rot(lTemp,1);
    vPos= llGetPos();
    rRot = llGetRot();

    rotation r = llRotBetween(<1,0,0>,llVecNorm(<vTargetPos.x - vPos.x,vTargetPos.y - vPos.y,0.0>));
    debugSay("turning to face "+(string)r);
    //llSetRot(r);
    llRotLookAt(r, fStrength, fDamping);
}

Either llSetRot or llRotLookAt should turn it, I'd have thought, but neither do,  and I've tried a whole range of values for strength and damping.

What am I doing wrong, or is there something else I should try?    Is there something clever I can do with llNavigateTo or llPursue or something?  

 

Link to comment
Share on other sites

IIRC, setrot nor lookat work on objects set as pf characters. I haven't tested that in a while, but remember me griping about something similar.

I guess it's the physics flag itself.

I think my gripe was I couldn't aesthetically turn physics off/on to make use of rotlookat in between as it would stop velocity/motion.

I think I didn't want the script to have to do the grunt work of calculating and updating a KF motion constantly as an alternative.

Edited by Lucia Nightfire
  • Thanks 1
Link to comment
Share on other sites

I've tried sleeping the script but the only way I've found so far to get this to work is to call llDeleteCharacter in the main script and then send a link message to a helper script, which reads the target's position and turns to face them.     It doesn't work (or not with any value for llSleep() I've tried) in the main script.

I feel as if there's something obvious I must be missing -- it can't be an usual requirement, I'd have thought, that a pathfinding character turns to face in a particular direction, and  having to delete the character, only to re-create it after asking a separate script to rotate the object, seems a bit clunky, so say the least.

Isn't there a better way to do it?

 

 

Link to comment
Share on other sites

i'm testing with this, and it seems to work ok?...

  llExecCharacterCmd(CHARACTER_CMD_STOP, []); 
  llPursue(llDetectedKey(0), [PURSUIT_OFFSET, <-2.0, 0.0, 0.0>, PURSUIT_FUZZ_FACTOR, 0.2]);
  llSleep(1.0); // just enuff time to spin about & face  a target
  llExecCharacterCmd(CHARACTER_CMD_STOP, []); 
  llSleep(5.0); // stare at the target a bit
  doStuff();   // continue on

 

  • Thanks 2
Link to comment
Share on other sites

On 10/20/2021 at 5:14 PM, Xiija said:

i'm testing with this, and it seems to work ok?...

  llExecCharacterCmd(CHARACTER_CMD_STOP, []); 
  llPursue(llDetectedKey(0), [PURSUIT_OFFSET, <-2.0, 0.0, 0.0>, PURSUIT_FUZZ_FACTOR, 0.2]);
  llSleep(1.0); // just enuff time to spin about & face  a target
  llExecCharacterCmd(CHARACTER_CMD_STOP, []); 
  llSleep(5.0); // stare at the target a bit
  doStuff();   // continue on

 

Thanks.   I've played with this but I'm finding that triggering the turn in a separate script works more reliably for what I'm trying to do here, so I think I'll stick with that.

Thanks too, to my friend @Rolig Loon, who reminded me of Void Singer's uSteppedRotLookAt routine, which turns the NPC very smoothly.

Link to comment
Share on other sites

I still think we should be able to to use llMoveToTarget() and llRotLookAt() with an active pathfinding character state for more precise influence/control.

Pathfinding characters use "resilient" deflectors instead of the physics shape(s) of the links and, unlike regular physics state, allow >32 links so exotic characters can be created.

Edited by Lucia Nightfire
  • Like 1
Link to comment
Share on other sites

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