Talk:Rotate

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Dejunai here...

Just wanted to mention, I think that the syntax description, and example is a bit misleading for the 'Rotate' command. And I humblly thought I might be able to add some information.

<object>.Rotate <axis> <value>

Where <object> is a reference, and <axis> is either XY-or-Z is clearly what you would expect. On the otherhand <value> as described in the is degrees per second... Or specifically degrees/sec. And while this is accurate, it was misleading to me.

Certainly I didn't expect:

myobject.Rotate Z 180

to keep spinning, endlessly. So degrees per second was misleading to me.

I decided to play with it. And dicovered that repeated calls in the GameMode loop, does actaully spin the object on degrees per second. Fair enuf.

But this disbales any ability to call the Rotate command in a single line, and expect a desired result.

It seems to become intrinsicly depended on FPS.

myobject.Rotate Z 180

Would rotate myobject to face 180 degrees away from it original position after 1 second of calls. And subsequently bring it back to it's original position after two seconds of calls. Depending on frame rate this can be any number of calls. And will never be static across games ( let alone machines/players ).

myobject.Rotate Z 360

Will attempt to move the object in a full revolution over the course of 1 realtime seocnd.

If your FPS is ( an immpossible ) 360 the object will rotate 1 degree on a single call. If your FPS is 36 the object will rotate 10 degrees on a single call. If your FPS is 18, 5 degrees. Etcetera.

To rotate an object 90 degrees, in a single frame would require the variable of FPS to be declared. And the math would look a little like this:

myobject.Rotate Z (90*varFPS)

And since varFPS is impossible to define, It can't be done. Obviously GetAngle and SetAngle are alternatives for single frame rotation, This is intended as an extreme example of the issue.

But what about movement over actualy time. My investigations suggest that it will always over shoot the intended rotation. However speed of the rotation, will make this effect less noticable when set to a low degree per second.

The only reasonable use of this command, in my opinion is within a GameMode loop, using the varTimer to the number of seconds expected for the rotation to complete, and abusing the GetSecondsPassed command. However setting an object to rotate 30 degrees per second for 3 seconds, will never succeed in moving th eobject 90 degrees. It will always move it more, because of the nature of the command GetSecondsPassed being a float value.

This command is not without usefulness, and I'd be amiss to suggest anything of the sort. I just think the documentaion is unclear, and hope to some degree I have contributed to its proper implementaion.

-Dejunai

--JustTim 08:24, 6 May 2006 (EDT): You can use GetAngle and SetAngle if you want to rotate an object in one call.

How do you set an object to rotate constantly? I would try gamemode, but I'm afraid of what that'd do to FPS. Ub3rman123 06:01, 5 May 2010 (EDT)