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 hmm
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 =/

Re: Movement into cameradirection

greetings smile  at the top, try updating the code to:

Local velo:vector3df = Vector3df.Create()

Re: Movement into cameradirection

Function movement()
Local vel:vector3df = vector3df.create()
Local inertia:vector3df = vector3df.create()
Local m:matrix4 = New matrix4
vel = _vector3df(0,0,0)
inertia = _vector3df(0,0,0)
 
 
        If receiver.IsKeyDown(EKEY_KEY_W)
        vel = _vector3df(0,0,MOVEMENT_SPEED * frameDeltaTime))
        ElseIf receiver.IsKeyDown(EKEY_KEY_S)
        vel = _vector3df(0,0,-MOVEMENT_SPEED * frameDeltaTime)
        EndIf
 
        If receiver.IsKeyDown(EKEY_KEY_A)
        vel = _vector3df(-(MOVEMENT_SPEED * frameDeltaTime),0,0))
        ElseIf receiver.IsKeyDown(EKEY_KEY_D)
        vel = _vector3df((MOVEMENT_SPEED * frameDeltaTime),0,0))
        EndIf
        m= camera.getabsolutetransformation()   
        m.rotatevect(vel) 
        inertia.PlusEq(vel:vector3df)
        camera.setposition(camera.getposition().plus(inertia))
        camera.UpdateAbsolutePosition())
 
 
        
End Function