Topic: Hello i'am new here'

Hello i'am new here.
I like the irrlicht wrapper.
Can anyone help me?  Iam searching a code snipp for a 3d object  move in irrlicht.



'-------------------------------------------- MAIN ----------------------------------------------------------------------------
While (device.Run())
    timer:+MilliSecs()
    timer = MilliSecs()
    Driver.BeginScene(True, True, Null) 'SColor.createFromVals(0,200 , 200 , 200))
    str = "LastMousPosition= "
    str = + lastmousepos.getY()
    device.setWindowCaption(str)

    c = boxnodgr.GetPosition()
    d = boxnodgr.GetRotation()
    

   If Keys = 1  ' key W
         c.setX(c.getX() + (3 * Cos((d.getY()) * 3.14 / 180)))
         c.setZ(c.getZ() - (3 * Sin((d.getY()) * 3.14 / 180)))
   End If
   
'  .... analog key S
   
    If Keys = 4  ' key A
      d.setY(d.getY() - 5) ;
    End If
   
   
    boxnodgr.SetPosition(c)
    boxnodgr.SetRotation(d)
   
       
        smgr.drawAll()
       driver.endScene()
    keys=0
Wend
'-------------------------------------------- MAIN ----------------------------------------------------------------------------

my code do not work.
i  can move in x,z . But when i rotate my object i move in x,y way, not to the way where i have rotate it.


Sorry for my bad english......

Re: Hello i'am new here'

greetings smile  Irrlicht does not have built-in move or turn functions.  luckily though they have been worked out for the most part:

Function NodeMove(node:ISceneNode,x:Float,y:Float,z:Float)    
        
    ' from: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=4680            
    Local dest:Vector3df=Vector3df.createFromVals(x,y,z)
    node.getRelativeTransformation().transformVect(dest)
    node.setPosition(dest)
EndFunction

Function NodeTurn(node:ISceneNode,pitch:Float,yaw:Float,roll:Float)

    ' from: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=4680
    Local m:Matrix4=Matrix4.Create()
    Local n:Matrix4=Matrix4.Create()
    Local t:Matrix4=Matrix4.Create()
    
    m.setRotationDegrees(node.GetRotation())
    
    n.setRotationDegrees(_VECTOR3DF(0,0,roll))
    t.setRotationDegrees(_VECTOR3DF(pitch,0,0))
    n.MultEq(t)
    t.setRotationDegrees(_VECTOR3DF(0,yaw,0))
    n.MultEq(t)
        
    m.MultEq(n)
    node.SetRotation(m.getRotationDegrees())
EndFunction

Re: Hello i'am new here'

Hi,


thanks for your help.

Re: Hello i'am new here'

Hi gman,
your code work great.


Have you a little code-sample for a camera they follow my object ?
I was happy when i found a code for a 3rd Camera in Blitzmax with your irrlicht wrapper





Sorry for my bad english....