How Rotate a node 45 degrees around x axis

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
speedy15453
Posts: 22
Joined: Tue Nov 09, 2010 7:03 pm
Location: ohiio

How Rotate a node 45 degrees around x axis

Post by speedy15453 »

Can someone help me with some simple code to rotate a node around the x axis 45 degrees and the stop every time the user presses x.
as opposed to this:

Code: Select all

    if IsKeyDown(EKEY_CODE.KEY_KEY_X) = true then
      KeyIsDown(EKEY_CODE.KEY_KEY_X) = false
      x=1
      // add rotation animator
      dim position as core_vector3df = new core_vector3df(0,0,0)
      position = new core_vector3df(x,y,z)
      anim = scene.createRotationAnimator(position)
      node.addAnimator(anim)
    end

Thanks
Only after disaster can we be resurrected.
neil_123
Posts: 67
Joined: Wed Apr 07, 2010 8:50 pm

Post by neil_123 »

For rotating part, wont following way work?

Code: Select all

node->setRotation( vector3df(45, 0, 0) );
speedy15453
Posts: 22
Joined: Tue Nov 09, 2010 7:03 pm
Location: ohiio

It works

Post by speedy15453 »

I'm using RealStudio with the Franklin3d plugin for Irrlicht so my code looks like this:

Code: Select all

    
    if IsKeyDown(EKEY_CODE.KEY_KEY_X) = true then
      KeyIsDown(EKEY_CODE.KEY_KEY_X) = false
      x = x +45
      // add rotation animator
      dim position as core_vector3df = new core_vector3df(x,y,z)
      position = new core_vector3df(x,y,z)
      node.setRotation( position )
      node.updateAbsolutePosition()
      if x =360 then x=0
    end
Thank You!

This node jumps to the next position. Is there an easy way to see it rotate the 45 degrees ? I am working on a variation of the rubik's cube.
Only after disaster can we be resurrected.
Post Reply