Posted By: theDust
Physics cause difficulties measuring entity rotational speeds - 03/30/09 11:45
Hi, I need the rotational speeds (and directions of these speeds) of an object. An example, it should look like this at the end:
X-SPEED = rotating at 5 degrees per frame.(because abs(X) = 5)
X-DIRECTION = rotating anti-clockwise (because X is a negative number)
Y-SPEED = tilting at 10 degrees per frame.(because abs(Y) = 10)
Y-DIRECTION = tilting clockwise (because Y is a positive number)
Z-SPEED = tilting at 15 degrees per frame.(because abs(Z) = 15)
Z-DIRECTION = rolling clockwise (because Z is a positive number)
The calculations of this speeds are working with:
The calculation without physics is working ! But when my object is using physics the Rot_Speed has nearly random values and random sign (direction of speed).
Maybe its a time displacement in the calculation, caused of the physics. Any idea that could help?
More infos and the complete problem:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=257365&page=1
X-SPEED = rotating at 5 degrees per frame.(because abs(X) = 5)
X-DIRECTION = rotating anti-clockwise (because X is a negative number)
Y-SPEED = tilting at 10 degrees per frame.(because abs(Y) = 10)
Y-DIRECTION = tilting clockwise (because Y is a positive number)
Z-SPEED = tilting at 15 degrees per frame.(because abs(Z) = 15)
Z-DIRECTION = rolling clockwise (because Z is a positive number)
The calculations of this speeds are working with:
Code:
VECTOR Old_Rot, Now_Rot, Rot_Speed; while(1) { vec_set(Old_Rot, my.pan); vec_add(Old_Rot, vector(360,360,360)); //eliminate negative angles (optional) wait(1); vec_set(Now_Rot, my.pan); vec_add(Now_Rot, vector(360,360,360)); //eliminate negative angles (optional) vec_diff(Rot_Speed, Old_Rot, Now_Rot); wait(1); }
The calculation without physics is working ! But when my object is using physics the Rot_Speed has nearly random values and random sign (direction of speed).
Maybe its a time displacement in the calculation, caused of the physics. Any idea that could help?
More infos and the complete problem:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=257365&page=1