1 (edited by H&K 2007-03-01 20:16:40)

Topic: Gimble Lock?

Import irrlicht.b3d

Global TheEngine:ib3d_engine = _g_ib3d_engine
TheEngine.Graphics3D(800,600,32)

Global MyCamera:CAMERA = TheEngine.createCamera()
Global MyCube:PRIMITIVE = TheEngine.createCube()
Global MyLight:LIGHT = TheEngine.createLight()
 
MyLight.SetColor(200,200,200)

MyCamera.Position(0,0,15)
MyCube.Position (0,0,0)

MyCamera.Point(Mycube)

While (Not TheEngine.KeyDown(KEY_SPACE))
     TheEngine.RenderWorld()
     MyCamera.Point(Mycube)
     MyCamera.Move(0,0.1,0)

     TheEngine.UpdateWorld
     Flip -1
Wend

End

As you can see from the code, the Camera stats pointing "Forward", then moves upY but stays pointing at the cube, However when it gets to the point that the camera is pointing nearly striaght "down". It thows a wobbly. (Which I think is a Gimble lock, But Gimble is a character in Bloodlines, so I my be misstaken)
Anyway after the lock, it wont reaquire the cube as a target to point at.

ps. Its more obvious if you add a texture.

PPs Have I put Render/update and flip in the right order?

Re: Gimble Lock?

render/update is in the wrong order.  also dont need flip as Irrlicht doesnt use it.  i will look into the camera issue.  looks like when its at or near 90deg its got issues.  more than likely this wont happen if one entity is pointing at another if a camera is not involved although i havent tried it yet.  a neat feature of iB3D is the TrackEntity feature.  try this:

Import irrlicht.b3d

Global TheEngine:ib3d_engine = _g_ib3d_engine
TheEngine.Graphics3D(800,600,32)

Global MyCamera:CAMERA = TheEngine.createCamera()
Global MyCube:PRIMITIVE = TheEngine.createCube()
Global MyLight:LIGHT = TheEngine.createLight()
 
MyLight.SetColor(200,200,200)

MyCamera.Position(0,0,15)
MyCube.Position (0,0,0)

MyCamera.TrackEntity(Mycube)

While (Not TheEngine.KeyDown(KEY_SPACE))
     TheEngine.UpdateWorld
     TheEngine.RenderWorld()
     MyCamera.Move(0,0.1,0)
Wend

End

with TrackEntity the camera looks independently of the direction of movement...  kinda like walking forward but looking to the side.

Re: Gimble Lock?

ive started researching this.  the problem occurs when the node is moving and the X of the horizontal rotation nears 270 or 90.  i have a post out on the Irrlicht forums so lets hope someone has a thought.