Topic: Movement into cameradirection
Hi!
Got a problem: i cant move into the direction of the camera.
ive searched irrlicht forums, but in this bmaxversion theys solutions wont work at all
what am i doing wrong?
Function movement()
Local nodePosition:Vector3df = camera.getPosition()
Local velo:vector3df
If receiver.IsKeyDown(EKEY_KEY_W)
velo.setZ(nodePosition.getZ() + (MOVEMENT_SPEED * frameDeltaTime))
ElseIf receiver.IsKeyDown(EKEY_KEY_S)
velo.setZ(nodePosition.getZ() - (MOVEMENT_SPEED * frameDeltaTime))
EndIf
If receiver.IsKeyDown(EKEY_KEY_A)
velo.setX(nodePosition.getX() - (MOVEMENT_SPEED * frameDeltaTime))
ElseIf receiver.IsKeyDown(EKEY_KEY_D)
velo.setX(nodePosition.getX() + (MOVEMENT_SPEED * frameDeltaTime))
EndIf
Local x:Float,y:Float,z:Float
Local m:matrix4 = New matrix4
m= camera.getabsolutetransformation()
m.rotatevect(velo)
X=camera.getposition().getX()+velo.getx()
Y=camera.getposition().getY()+velo.getY()
Z=camera.getposition().getZ()+velo.getZ()
camera.setposition(_VECTOR3dF(x,y,z))
End Function
get the error: unhandlet exception: attempt to access field or method of null object at "m.rotatevect(velo)"
hope anyone can help =/