Jump to content
Sign in to follow this  
Shanbo Baddingham

Rotation of a physical object

Recommended Posts

 llSetLocalRot( llGetLocalRot() * llRotBetween( <0.0, 0.0,1.0> *llGetLocalRot(), <0.0, 0.0,1.0> ) ); 

 It doesn't make any difference whether the object is physical or not.  If you want to rotate its Z axis to point uip, that's how to do it.

Share this post


Link to post
Share on other sites

And if I wanted to point the X axis straight up, would that become

llSetLocalRot( llGetLocalRot() * llRotBetween( <1.0, 0.0,0.0> *llGetLocalRot(), <0.0, 0.0,1.0> ) );

And if I wanted to point the Z axis to the left, would that be

llSetLocalRot( llGetLocalRot() * llRotBetween( <0.0, 0.0,1.0> *llGetLocalRot(), <1.0, 0.0,0.0> ) );

Just trying to get the format down

Share this post


Link to post
Share on other sites

I think the problem is that llSetRot and similar don't work on physical prims.

In this instance, the simplest method is to use llLookAt(), since that works with both physical and non-physical objects and points the Z axis (rather than the X axis, which is what most functions use) at the specified position.

So try something like:

integer toggle;default{	state_entry()	{		llSay(0, "Hello, Avatar!");	}	touch_start(integer total_number)	{		toggle=!toggle;		if(toggle){			llLookAt(llGetPos()+<0.0,0.0,1.0>,1.0,0.1); // look at a point 1 metre above me		}		else{			llStopLookAt(); // turn the lookat off		}	}}

 

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