Game Development Community

Different rotation speeds

by rwillis · in Torque X 2D · 08/26/2007 (10:44 pm) · 2 replies

If I create a T2DSceneObject manually in code like below then it rotates very quickly.

T2DSceneObject enemy01 = TorqueObjectDatabase.Instance.FindObject("enemy01");
enemy01.Visible = true;

public void Update()
{
enemy01.Rotation += 1;
}



But if I do it through a component like below then it rotates very slowly. Why is this?

public void SceneObject
{
get{return _sceneObject;} //owner
}

SceneObject.Rotation += 1

#1
08/27/2007 (2:06 pm)
Set a break point on both SceneObject.Rotation += 1; and enemy01.Rotation += 1; and see if the value at SceneObject.Rotation is not getting reset to 0 each time. At least thats what it sounds like its doing. A shorthand method to accomplish the same task: SceneObject.Rotation++; enemy01.Rotation++;
#2
08/28/2007 (3:10 pm)
Yea, it's getting reset back to zero. Has anyone noticed this happening to them also? Basicly, doing "SceneObject.Rotation +=1" (in which SceneObject refers to the object the component is on) causes the object to rotate much slower than if it was "objectreferencedThroughScript.Rotation +=1", in which the object was referenced through script.