90 degrees angles

Blitz3D Forums/Blitz3D Programming/90 degrees angles

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Cough. He wants to save the rotations. It is the gimbal lock problem.

If KeyDown(28) Then;---How do I make this not change the cube's angle?---
	gpitch#=EntityPitch(cone,1)
	If Abs(EntityPitch(cone,1))>89.98 Then
		TurnEntity cone,90,0,0,1
		gyaw#=EntityYaw(cone,1)
		groll#=EntityRoll(cone,1)
		TurnEntity cone,-90,0,0,1
	Else
		gyaw#=EntityYaw(cone,1)
		groll#=EntityRoll(cone,1)
	EndIf

	RotateEntity Cone,gpitch,gyaw,groll
End If


Note however my understanding is that at -90 and 90 pitch, yaw and roll are combined, so you will never get them back separately but the effect of applying these values should be the same. Well it seems to work above anyway, but I have not tested it properly. Fredborg posted some functions here
www.blitzbasic.com/Community/posts.php?topic=31781
to get global pitch yaw and roll in these circumstances, and they may be more suitable as they use a temporary pivot and will not disturb the original entity.