In my experience here , as long as the 'angulo' surpasses 90 or -90 degrees, then ConvertWorldToLocalPosition() returns crazy values and the Entity rotates crazyful:
Code: Select all
InitEngine3D(#PB_Engine3D_NoLog,#PB_Compiler_Home+"Compilers\Engine3d.dll")
Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/fonts", #PB_3DArchive_FileSystem)
Parse3DScripts()
InitSprite():InitKeyboard():InitMouse()
OpenWindowedScreen(OpenWindow(0,0,0,1024,768,"title",#PB_Window_BorderLess|#PB_Window_ScreenCentered),0,0,1024,768,1,0,0,#PB_Screen_WaitSynchronization)
CreateLight(0,$EEEEEE,-1,1,6,#PB_Light_Point)
CreateCamera(0,0,0,100,100)
MoveCamera(0,0,0,4,#PB_Absolute)
CreateMaterial(0,0,$55DDEE)
CreateSphere(0,1,4,2)
CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)
CreateText3D(0,"csgf","BlueHighway-8",0.5,$aa9999bb):MoveText3D(0,0,1.4,0):CreateNode(0):AttachNodeObject(0,Text3DID(0))
Repeat:While WindowEvent()<>#PB_Event_None:Wend
ExamineMouse():ExamineKeyboard()
angulo.f+Degree(MouseDeltaX()/200):angulo-360*Round(angulo/360,#PB_Round_Nearest)
Text3DCaption(0,StrF(angulo,0))
ConvertWorldToLocalPosition(EntityID(0),10,20,-0.2)
x.f=GetX():y.f=GetY():z.f=GetZ()
m.f=Sqr(Pow(x,2)+Pow(y,2)+Pow(z,2))
EntityFixedYawAxis(0,#True,x/m,y/m,z/m)
Yaw(EntityID(0),angulo,#PB_Local)
RenderWorld()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)