Get true rotation angle on X Axis

Blitz3D Forums/Blitz3D Programming/Get true rotation angle on X Axis

KronosUK(Posted 2010) [#1]
Is it possible to get the true angle of rotation of an entity on the x axis. Entitypitch only gives -90 to +90 angle. I need the value of 0 to 359.

I need to track the change in angle of a wheel in order to calculate how far to move a tank track.


Warner(Posted 2010) [#2]
That is common behaviour. With a bit searching, you can find posts that are related: http://www.blitzbasic.com/Community/posts.php?topic=31781
However, can't you solve this in another way? How are you rotating the wheel?
If you are using animation, use the animationspeed instead of the pitch.
Or if you are rotation the wheel yourself, with ie. TurnEntity, keep track of how much rotation you've given the wheel in a separate variable.


BoneStan(Posted 2010) [#3]
Is it possible to get the true angle of rotation of an entity on the x axis.

I didn't know a command to get the angle, but you could write a function which record the angle of rotation.




Gabriel(Posted 2010) [#4]
You could convert the euler angle representation to a direction vector and then simply judge when it's close to 0,1,0.

It's going to be something like

x = cos(yaw)*cos(pitch)
y = sin(yaw)*cos(pitch)
z = sin(pitch)


But it all depends on the order of rotation and it's been so long since I used Blitz3D that I no longer remember that. If you find my guess isn't right, you can probably google for the other versions.


RifRaf(Posted 2010) [#5]
Couldnt you just do somthing like
val#=180+(EntityPitch(myent)*2)

converting the -90 to 90 range into 0 - 360.


KronosUK(Posted 2010) [#6]
I am using jv-ode to power the guidewheel ,however jv-ode seems to give pitch angles in the same way as blitz3d does.

@RifRaf unfortunately this doesn't work, when angle goes past 360 it doesn't flip over to 0 it counts back from 360 eg 358, 359,358

In this small example 358 could be either the forward angle or reverse angle but theres no way of telling.

Anyway I have now got something that looks ok by using the Force value thats driving the wheels. This pretty much correlates to velocity.

Thanks for all your suggestions.