90 degrees angles
Blitz3D Forums/Blitz3D Programming/90 degrees angles
| ||
I need to save the rotation of objects in a program I am using. If any one knows how to get the true Pitch, Yaw, Roll of the cube at 90 degrees angles it would be helpful. |
| ||
I have no idea what you're trying to do. |
| ||
See when you press Enter the cube's angle changes, I want to rotate the entity without changing the cube's angle. I know it is to do with 90 degrees angles. |
| ||
Does any one know want I mean? |
| ||
It sounds like you want angles in 360 degrees Instead of +-180 and +-90. Is that it? Andy |
| ||
Do you mean this:If KeyDown(200)= true Then ; UP ARROW j=j+1 RotateEntity Cone,j,0,0 End If If KeyDown(208)= true Then ; DOWN ARROW j=j-1 RotateEntity Cone,j,0,0 End If If KeyDown(203)= true Then ; LEFT ARROW j=j+1 RotateEntity Cone,0,j,0 End If If KeyDown(205)= true Then ; RIGHT ARROW j=j-1 RotateEntity Cone,0,j,0 End IfIt is a sloppy hack BUT what you are really referring to are called Euler Angles... Blitz uses them to simulate rotation. Try that and see... |
| ||
If you want to rotate it in 90 degree angles, why not just..RotateEntity Cone,EntityPitch(cone,true)+90 , EntityYaw(cone,true) , EntityRoll(cone,true) , true If you use turnentity, it uses the entities local axis. So, by using rotateentity as above, you can rotate it without knowing the current rotation values :o) Hope that helps. |
| ||
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. |
| ||
You should get something for that cough ;) |
| ||
I suspect he is trying to do a dice game... You know... final dice position etc... I have these for a dice I created in RHINO. I had to create an animation of a roll/toss though...; DICE 1 If dice1=1 Then xs#=90 : ys#=0 : zs#=0 If dice1=2 Then xs#=180 : ys#=0 : zs#=0 If dice1=3 Then xs#=0 : ys#=0 : zs#=90 If dice1=4 Then xs#=180 : ys#=0 : zs#=90 If dice1=5 Then xs#=0 : ys#=90 : zs#=0 If dice1=6 Then xs#=270: ys#=0 : zs#=0 Probably not incredibly accurate since it was my second game ever in Blitz 3d. If that helps RZ |
| ||
Yes, thank you DJWoodgate, Sorry everyonne trying to guess what I want. |