1 (edited by HondaDarrell 2007-05-11 21:02:39)

Topic: Camera Trouble

Hi gman, I have a strange problem with my camera since v1.3, I can't figure out why.
My camera code worked with v1.2, I hadn't changed anything since.
The camera should follow the player from behind, but now it only stays in the center of the screen no matter what vector the position is and seems to rotate weird. Also it seems to clip object much closer that it's supposed to. I cant see the player if he moves forward and I can't see some of the objects that should be in the scene.
I think it may have something to do with the matrices or just the camera. I also think it could be a problem from my second scene manager.

'Update Player
Local M1:Matrix4 = Matrix4.create()
Local M2:Matrix4 = Matrix4.create()
Local Rot:Vector3df = Momentum

PlayerNode.updateAbsolutePosition()
M1.setRotationDegrees( PlayerNode.GetRotation())
M2.setRotationDegrees( Rot )
M1.MultEq( M2 )
PlayerNode.SetRotation( M1.getRotationDegrees())
PlayerNode.setPosition( PlayerNode.getAbsolutePosition().Plus( Velocity ))
PlayerNode.updateAbsolutePosition()
M1.Destroy()
M2.Destroy()

'Update Camera
Local M3:Matrix4 = Matrix4.create()
Local Forward:Vector3df = _VECTOR3DF( 0, 0, 1 )
Local Up:Vector3df = _VECTOR3DF( 0, 1, 0 )
Local OffSet:Vector3df = _VECTOR3DF( 0, 5, -15 )

M3.setRotationDegrees( PlayerNode.GetRotation())
M3.transformVect( Forward )
M3.transformVect( Up )
M3.transformVect( OffSet )
Offset.PlusEq( PlayerNode.getPosition())
CAMERA.setPosition( OffSet )
CAMERA.setUpVector( UP )
OffSet.PlusEq( Forward )
CAMERA.setTarget( OffSet )
CAMERA.updateAbsolutePosition()
M3.Destroy()

I could post more code, but there's a lot.

Re: Camera Trouble

I sent you an email. smile

Re: Camera Trouble

greetings smile  will take a look when i find some time.  code came down properly.

Re: Camera Trouble

sorry it took me so long to get to this hmm  the Scn manager was rendering orthogonal which is why your ship was wonky.  i think your problem lies in that while the managers can share resources, a node cannot belong to multiple scene managers.  therefore you cant render the Scn manager from the camera created in the Env manager.  i added a second camera called Cam2 from the Env and changed Cam to come from Scn.  i added the setFarValue() call for Cam2 and everything appeared to be shored up.  give her a whirl and let me know how she flies.  i have emailed you the modified source.  its neat that you are trying out the multiple manager functionality smile