Wrong EntityDirectionX/Y/Z()

All bugs related to the 3D engine
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Wrong EntityDirectionX/Y/Z()

Post by Psychophanta »

Look at this; play pressing right and left arrow keys.
It always returns the same 'Entitydirection' :shock:

Code: Select all

InitEngine3D(#PB_Engine3D_NoLog,#PB_Compiler_Home+"Compilers\Engine3d.dll")
InitSprite():InitKeyboard():InitMouse()
OpenWindow(0,0,0,800,600,"v",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600,1,0,0,#PB_Screen_WaitSynchronization)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,10,#PB_Absolute)
Createcone(0,1,2):CreateEntity(0,MeshID(0),#PB_Material_None)
Repeat
  Repeat:Eventodeventana.i=WindowEvent():Until Eventodeventana=0
  ExamineKeyboard()
  if KeyboardReleased(#PB_Key_left):Roll(EntityID(0),90,#PB_Absolute|#PB_World)
  elseif KeyboardReleased(#PB_Key_right):Roll(EntityID(0),-90,#PB_Absolute|#PB_World)
  endif
  debug strf(EntityDirectionX(0),2)+","+Strf(EntityDirectionY(0),2)+","+StrF(EntityDirectionZ(0),2)
  RenderWorld()
  FlipBuffers():Delay(16)
Until KeyboardPushed(#PB_Key_Escape)
ADDENDUM:
And playing with this one is even more fun (need explanation :? ):

Code: Select all

InitEngine3D(#PB_Engine3D_NoLog,#PB_Compiler_Home+"Compilers\Engine3d.dll")
InitSprite():InitKeyboard():InitMouse()
OpenWindow(0,0,0,800,600,"v",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600,1,0,0,#PB_Screen_WaitSynchronization)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,10,#PB_Absolute)
Createcone(0,1,2):CreateEntity(0,MeshID(0),#PB_Material_None)
Repeat
  Repeat:Eventodeventana.i=WindowEvent():Until Eventodeventana=0
  ExamineKeyboard()
  if KeyboardReleased(#PB_Key_left):EntityDirection(0,-1,0,0,#PB_World,#PB_Vector_Y)
  elseif KeyboardReleased(#PB_Key_right):EntityDirection(0,1,0,0,#PB_World,#PB_Vector_Y)
  endif
  debug strf(EntityDirectionX(0),2)+","+Strf(EntityDirectionY(0),2)+","+StrF(EntityDirectionZ(0),2)
  RenderWorld()
  FlipBuffers():Delay(16)
Until KeyboardPushed(#PB_Key_Escape)
And with EntityYaw(), which always returns 0 :o :

Code: Select all

InitEngine3D(#PB_Engine3D_NoLog,#PB_Compiler_Home+"Compilers\Engine3d.dll")
InitSprite():InitKeyboard():InitMouse()
OpenWindow(0,0,0,800,600,"v",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0),0,0,800,600,1,0,0,#PB_Screen_WaitSynchronization)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,10,#PB_Absolute)
Createcone(0,1,2):CreateEntity(0,MeshID(0),#PB_Material_None)
Repeat
  Repeat:Eventodeventana.i=WindowEvent():Until Eventodeventana=0
  ExamineKeyboard()
  if KeyboardReleased(#PB_Key_left):EntityFixedYawAxis(0,1,0,0,1):Yaw(EntityID(0),90,#PB_World|#PB_Absolute)
  elseif KeyboardReleased(#PB_Key_right):EntityFixedYawAxis(0,1,0,0,-1):Yaw(EntityID(0),90,#PB_World|#PB_Absolute)
  endif
  debug EntityYaw(0,#PB_Absolute|#PB_Engine3D_Raw)
  RenderWorld()
  FlipBuffers():Delay(16)
Until KeyboardPushed(#PB_Key_Escape)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
pf shadoko
Enthusiast
Enthusiast
Posts: 386
Joined: Thu Jul 09, 2015 9:07 am

Re: Wrong EntityDirectionX/Y/Z()

Post by pf shadoko »

strange
it work with
EntityDirection(0,-1,0.01,0,#PB_World,#PB_Vector_Y)
but don't work with
EntityDirection(0,-1,0.001,0,#PB_World,#PB_Vector_Y)
too small ?
it's an Ogre bug !!
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: Wrong EntityDirectionX/Y/Z()

Post by Psychophanta »

Well then I deserve an award for finding a bug in the Ogre3D 8) :D
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply