This tip shows that a generic created Ogre camera automatically turns 180º over its own Z axis everywhen it is being "forced" to invert the 'world' floor (ie. the XZ plane).
In other words:
When you record video with your real cam in your real world, you can turn 180º your cam and the world you get is a 180º rotated world.
Well, the Ogre cameras just seem to not be able to see a 180º rotated world, that's all.
And that is definitely not a good for serious purposes in 3D, that behaviour is undesirable under certain serious 3D stuff.
Check the code please, it is ilustrative.
Code: Select all
;This tip shows that a generic created Ogre camera automatically turns 180º over its own Z axis everywhen it is being "forced" to invert the world floor (ie. the XZ plane)
;At the main loop, probe yourself to test only one of the 3 Macros below
;Tip made 20120318 For PB4.60 by Psychophanta
InitEngine3D():InitSprite():InitKeyboard():InitMouse()
ExamineDesktops()
bitplanes.b=DesktopDepth(0):RX.w=DesktopWidth(0):RY.w=DesktopHeight(0)
scr.l=OpenScreen(RX.w,RY.w,bitplanes.b,"CameraLookAtBug")
Add3DArchive("..\sources\",#PB_3DArchive_FileSystem)
CreateCube(0,40)
UsePNGImageDecoder():LoadTexture(0,"PureBasicLogoNew.png"); <- Use any squared picture (64x64, 128x128, 256x256, 512x512...)
CreateMaterial(0,TextureID(0)) ; Material
CreateEntity(0,MeshID(0),MaterialID(0),0,0,0)
CreateCamera(0,0,0,100,100)
AmbientColor($fafafa); <- Essential for clarity
Macro TurnCameraOverXaxis
CamLocateX.f=0:CamLocateY.f=0:CamLocateZ.f=100:CamLocateDistance.f=100; <- start looking at the body from back (100 units lenght from XY plane, ie. display monitor surface plane)
CamAngleX.f+MouseDeltaY()/600
CamLocateY.f=CamLocateDistance.f*Sin(CamAngleX)
CamLocateZ.f=CamLocateDistance.f*Cos(CamAngleX)-MouseWheel()*4
EndMacro
Macro TurnCameraOverYaxis
CamLocateX.f=0:CamLocateY.f=0:CamLocateZ.f=100:CamLocateDistance.f=100; <- start looking at the body from back (100 units lenght from XY plane, ie. display monitor surface plane)
CamAngleY.f+MouseDeltaX()/600
CamLocateX.f=CamLocateDistance.f*Sin(CamAngleY)
CamLocateZ.f=CamLocateDistance.f*Cos(CamAngleY)-MouseWheel()*4
EndMacro
Macro TurnCameraOverZaxis
CamLocateX.f=0:CamLocateY.f=-100:CamLocateZ.f=0:CamLocateDistance.f=100; <- start looking at the body from upside
CamAngleZ.f+MouseDeltaX()/600
CamLocateX.f=CamLocateDistance.f*Sin(CamAngleZ)
CamLocateY.f=CamLocateDistance.f*Cos(CamAngleZ)-MouseWheel()*4
EndMacro
Repeat
ExamineKeyboard():ExamineMouse()
; TurnCameraOverXaxis; <- camera does rotate 180º over itself when it surpass the XY plane
; TurnCameraOverYaxis; <- the only one in which the camera do not rotate over itself
TurnCameraOverZaxis; <- camera does rotate 180º over itself when it surpass the YZ plane
CameraLocate(0,CamLocateX.f,CamLocateY.f,CamLocateZ.f)
CameraLookAt(0,0,0,0); <- this function does rotate camera over its own z axis, why?
RenderWorld()
FlipBuffers():Delay(3)
Until KeyboardPushed(#PB_Key_Escape)


