Jump to content

Rotating towards the player on 2 axis


Ixia
 Share

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

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

Recommended Posts

Hi

Hitting my head against a wall with this... can't seem to figure out how to do it.

I want and object to slowly point towards the player (preferably set-able as x degrees per loop)

Now but I only want it to rotate on global/world z axis and local y axis :D Can't seem to get it to that :/

Link to comment
Share on other sites

I hate to tell you, but two axis represent all possible facings (just not all orientations).

the function you can try are
llLookat
llRot2Target with llRotTarget, at_rot_target, and not_at_rot_target

and try them in combination with
llSetStatus( STATUS_ROTATE_X, FALSE );

Link to comment
Share on other sites

I want it non-physical and with llSetRot / llSetLinkPrimitiveParamFast :/

And what do you mean with that two axis represent all possible facings, but not all orientations?

I tried around with llRotBetween but no idea how ot apply the result i guess

Link to comment
Share on other sites

for setRot models, if you set the z rotation, then they rotation you shouldn't need to limit anything.

what might help you is SLERP... forget about what the name says or how it works, just know that if you plug in the starting rotation, and the ending rotation, that the number you stick in with them will be the fraction of movement between those two rotations.

it essentially works out to  (a + (1/t )(b-a)), where a=startRot, b=endRot, t=steps between

if a is where you are at when you begin, and b is where you want to be when you end, then the result can be added t times to the current rotation to get from start to end.

Link to comment
Share on other sites

 


Innula Zenovka wrote:

I am not sure I understand exactly what you want to do, but you might find this
over at SLU helpful.   Even if it's not what you're trying to do, it's still worth a read -- it was her walkthrough that got me on the road to  understanding how to use llRotBetween.

 

ah, that was what I needed :D thanks

Will have to see how to make it slower, but thats the easy part I guess

 

@Void Singer: Well SLERP works too i guess, but since its fractions of the rotation i can't say "rotate towards this but max 2 degress per loop"

Link to comment
Share on other sites

Glad it helped.  I think if you want to control the speed, llRotLookAt might be what you want (it works on both physical and non-physical objects) and, as I only discovered the other day, with Void's help, you can just use the formulae Chalice gives there to get the rotations you need for the rotation "target" in llRotLookAt.   Certainly worth a play.

Link to comment
Share on other sites

SLERP only returns the rotation you want, the rate control would be up to you, but you could easily say I want it to take x seconds to go from a to b, then you your preferred number of steps to as a divisor for the time as well as the step number for SLERP. assuming you still want discrete stepped movement.

Link to comment
Share on other sites

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