Game Development Community

Jerking Rotation

by Kiyaku · in Torque Game Engine Advanced · 04/03/2008 (11:39 am) · 4 replies

Hello,
i tried to script with TGEA today and i used the Beta 2 Version.

I simply wanted to let a stone rotate but its somehow not fluently. For rotation i tried many ways, schedule, triggers (ticks), etc.

For example i used this code for rotation:

function fncRotateStone() 
{ 
   if(mRadToDeg(getWord(stein1.getTransform(), 6)) > 0) 
   {  
     echo("is dabei"); 
     $rotation = mRadToDeg(getWord(stein1.getTransform(), 6)) - 0.1; 
 
     stein1.setTransform(stein1.getPosition() SPC "0 0 1 " SPC mDegToRad($rotation)); 
 
     schedule(1, 0, "fncRotateStone"); 
   } 
}

Might not be the best but i just wanted to let it rotate, though its not smooth.

Even with the code found here its not smooth:

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9480


What am i doing wrong? Or is it the beta?

BTW even trying to do it with movement its jerky...

#1
04/03/2008 (11:44 am)
Objects are definitely not designed to be manipulated by script like this in TGEA.

Knowledge of the properties of the primary game classes in the hierarchy is also very useful--for example, the Item class has built in auto-rotation handled in C++.

In the general case, TGEA is designed so that you implement behaviors and functionality of objects in C++, and then utilize (start/stop in this case) those functionalities via TorqueScript.
#2
04/03/2008 (11:52 am)
So what do you do if you want to let a object run a cycle or an 8-course, can i use predefined datablocks for it, or do i have to script it in C++?
#3
04/03/2008 (12:02 pm)
Quote:
So what do you do if you want to let a object run a cycle or an 8-course, can i use predefined datablocks for it, or do i have to script it in C++?

Can you be more specific? I have no idea what you mean by "cycle" or "8-course".
#4
04/03/2008 (12:15 pm)
Oh i meant circle, sorry.

Like imagine some object is flying around a cylinder. The object have to change it's rotation and forward movement static.

Or something is following the player and always charging to his position. It has to rotate towards the player with a static movement.

Just examples. I don't want to fix too much on those examples, i just mean rotations and movements in general (for non-player controlled objects).