Hey guys. I was working on my editor, and i've come to a part where i want to assess whether my working plane is above the camera's middle, so i can flip it so it can be seen from below as well, and be picked. (I believe disable backface cull, does not do anything to collisions, so my pick would go right through it.)
So i though, the best way, would be to point the plane at the camera. If the x rotation came back between a certain range, i could get the direction and rotate the plane by 180. Anyways, i noticed if i record the current rotations, and rotate the entity back to them, the entity starts to spin, but only on the Y axis...??? Is this a bug?
Arrow keys Up and Down to move the plane. It should spin slightly.
Graphics3D 800,600
SetBuffer BackBuffer()
Global camera = CreateCamera()
PositionEntity camera,0,50,0
CameraFogMode camera,1
CameraFogRange camera,100,300
Global plane = CreatePlane()
EntityColor plane,255,255,100
Global plane_texture = CreateTexture(64,64)
SetBuffer TextureBuffer(plane_texture)
Color 10,10,10
Rect 0,0,64,64
Color 80,80,80
Rect 1,1,62,62
SetBuffer BackBuffer()
ScaleTexture plane_texture,6,6
EntityTexture plane,plane_texture
Color 255,255,255
While Not KeyHit(1)
If KeyDown(200) Then
MoveEntity plane,0,0.1,0
End If
If KeyDown(208) Then
MoveEntity plane,0,-0.1,0
End If
rot_x# = EntityX(plane,True)
rot_y# = EntityY(plane,True)
rot_z# = EntityZ(plane,True)
RotateEntity plane,rot_x,rot_y,rot_z
UpdateWorld
RenderWorld
Text 0,0,"plane y = "+rot_y
Flip
Wend
End
|