Sign in to follow this  
Followers 0
Pixel

Rotation Question

3 posts in this topic

I have a question about rotation. I know the different types of rotation (RotateYaw, RotatePitch, and RotateRoll) but what if I wanted to rotate it a diagonal way, like inbetween X and Y?

0

Share this post


Link to post
Share on other sites

I have a question about rotation. I know the different types of rotation (RotateYaw, RotatePitch, and RotateRoll) but what if I wanted to rotate it a diagonal way, like inbetween X and Y?

the function rotateto allows you to rotate an object's yaw, pitch and roll all at once. This is how you would rotate the object diagonally.

From Zeroy's Script Reference:

f7gb2I0.png

You can use either script_origins in radiant to define the new angles or type in a new yaw, pitch, and roll.

Examples of each:

 

Example1()
{
	object = getent( "object_targetname", "targetname" );
	origin = getent( "origin_targetname", "targetname" );
	
	object rotateto( origin.angles, 5, 1, 3 ); 
	/* The object rotates to the origin's angles over the time period of 5 seconds with an acceleration time of 1 and deceleration time of 3 */
	object waittill( "rotatedone" );
	
}

Example 2()
{
	object = getent( "object_targetname", "targetname" );
	object rotateto( (20, 120, 240), 5, 1, 3 );
	/* The object rotates to the angles specified over the time period of 5 seconds with an acceleration time of 1 and deceleration time of 3 */
	object waittill( "rotatedone" );

}
Excuse any mistakes above I haven't tried scripting in forever

EDIT:

You can also get your object's angles in the function and simply add to those angles like so:

Example3()
{
	object = getent( "object_targetname", "targetname" );
	oldang = object.angles;
	
	object rotateto( oldang+(50,50,50), 5, 1, 3 );
	/* The object rotates to the old angles plus 50 each over the time period of 5 seconds with an acceleration time of 1 and deceleration time of 3 */
	object waittill( "rotatedone" );
}
The above could best be used in a loop that has a designated ending. [eg: for(i=0;i<10;i++)]
0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0