Page 1 of 1

Wrong EntityDirectionX/Y/Z()

Posted: Sat Jun 15, 2024 5:45 pm
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)

Re: Wrong EntityDirectionX/Y/Z()

Posted: Sat Dec 07, 2024 11:54 pm
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 !!

Re: Wrong EntityDirectionX/Y/Z()

Posted: Sun Dec 08, 2024 9:52 am
by Psychophanta
Well then I deserve an award for finding a bug in the Ogre3D 8) :D