entitypitch problem

Blitz3D Forums/Blitz3D Programming/entitypitch problem

I have created a cylindrical mesh like the wheel on an old slot machine. I turn it using rotateentity. I view the rotation by using entitypitch...

But the number reports weird. I was expecting 0 to 359 as a report of the angle but it goes to 90 and -90 twice...

I assume it is because it assumes it is rotating a stick.

Is there a way to report the angle in 0 to 359 true? I was just going to try and code a simple slot machine.

Knowing the angle would let me check for SLOT!!!

-RZ

You must be using a variable already to rotate the mesh by 'angle' degrees,

e.g. rotateentity wheel,angle,0,0,1 why don't you just use it rather than trying to retrieve the rotation using entitypitch?

This is a problem with Euler angles. See your other angles too, and you will notice that when the 90 value repeats, the pitch or roll is different.

good luck!

Shambler... yes I am using a variable to rotate. I wanted to use that so I could TRACK the wheels rotation angle and use that to check if the wheel had certain combinations. You know... A slot machine like in Vegas. OR one of the older fruit machines in the U.K. same thing thereabouts.

Kurix... OK will check those. thought they would remain the same if I didn't set them.

{{EDIT}}
Nope... here is the weird thing:
I used 0 through 9 as numbers on the face of the wheel. The wheel is a b3d obbject (thanks to Ultimate Unwrap.)

# P R Y
0 72 180 -180
9 38 -180 180
8 0 180 -180
7 -38 180 -180
6 -65 180 -180
5 -65 0 0
4 -45 0 0
3 0 0 0
2 38 0 0
1 72 0 0

Now the numbers aren't perfect since I was just using the down arrow to rotate this BUT I cann see the pattern. Interesting how this works. I wonder if I can create a series that would rotate the entity to these parameters but would appear as it were rotating or spinning...

RZ

Thanks guys!

Is there a transposition for euler angles?

I went here:
http://mathworld.wolfram.com/EulerAngles.html
and my head started to hurt.

-RZ

Rook, do what Shambler said - instead of converting the euler angles back to degrees just use a variable together with RotateEntity and track the variable value. If you have 10 positions on your wheel that would be 360 / 10 = 36 degrees for each position. So your wheel positions would be something like this:

0 = 0
1 = 36
2 = 72
...yada yada

I did this:
Graphics3D 800,600,32,1
SetBuffer BackBuffer()
Cls
; ########   SETUP PLACE HOLDERS FOR EULER ANGLES
Dim pit(10) ; PITCH
Dim rol(10) ; ROLL
Dim ya(10) ; YAW
; ########   LOAD THE ACCORDING EULER ANGLES FOR EACH NUMBER 0 - 9
pit(0)=72
pit(1)=39
pit(2)=0
pit(3)=-38
pit(4)=-70
pit(5)=-70
pit(6)=-40
pit(7)=0
pit(8)=37
pit(9)=73

rol(0)=180
rol(1)=-180
rol(2)=180
rol(3)=180
rol(4)=180
rol(5)=0
rol(6)=0
rol(7)=0
rol(8)=0
rol(9)=0

ya(0)=-180
ya(1)=180
ya(2)=-180
ya(3)=-180
ya(4)=-180
ya(5)=0
ya(6)=0
ya(7)=0
ya(8)=0
ya(9)=0
; ########   Create a camera so we can see it
camera=CreateCamera()
PositionEntity camera,19,0,-60
; ########   add some lightage
sun = CreateLight()
PositionEntity sun,835,1456,502
RotateEntity sun,80,0,-900
; ########   Load and position the meshes for the wheels already covered in Ult. Unwrap
mesh=LoadMesh( "wheel1.b3d" )
mesh2=CopyEntity(mesh)
mesh3=CopyEntity (mesh)
PositionEntity mesh,0,0,0
PositionEntity mesh2,11,0,0
PositionEntity mesh3,22,0,0
; ################################################## START OF GAME LOOP
While Not KeyHit(1)

If KeyDown(57)=True Then ; ########   WHACK THE SPACEBAR
euler=euler+1
	RotateEntity mesh,pit(euler),rol(euler),ya(euler)
	RotateEntity mesh2,pit(euler),rol(euler),ya(euler)
	RotateEntity mesh3,pit(euler),rol(euler),ya(euler)
	If euler = 9 Then euler = 0

EndIf

  UpdateWorld()
  RenderWorld()
;Text 0,0,"TrisRendered "+TrisRendered()
Text 0,20,"rotation: "+newe
Text 0,40,"PITCH: "+EntityPitch(mesh)
Text 0,60,"ROLL: "+EntityRoll(mesh)
Text 0,80,"YAW: "+EntityYaw(mesh)

  Flip
Wend
End
Now I have to figure out some way to make it more random... THEN spin and slow down like a real slot machine.
-RZ

Standard Fruit machines have 12 'fruits' on each reel. These are spaced equally around the circumference every 30 degrees.

So to make the selection, speed up the rotation and slow it etc, just ensuring it comes to rest at a multiple of 30.

In fact, you can ensure it starts to slow at a multiple of, say 20, then take a further definite 160 degrees to stop.