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

thanks, i changed my code a bit, and with your hint it finally works,.. but theres a new problem

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

but theres still a problem, my camera is shaking a bit when i'm strafing left& right
http://www.xup.in/dl,38258014/Irrlicht_Projek2t.rar/
i played around with some moventrelated vars, i could change

 
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

to


 
If receiver.IsKeyDown(EKEY_KEY_A)
        vel = _vector3df(-0.1,0,0))
        ElseIf receiver.IsKeyDown(EKEY_KEY_D)
        vel = _vector3df(0.1,0,0))
        EndIf

theres no more shaking while moving, but it looks strange at the beginning and the end of the strafe-movement :<