I can't find how to get the values for x,y,z using aboslute

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

I can't find how to get the values for x,y,z using aboslute

Post by speedy15453 »

I know I saw the code to get the values for x,y,z but i can't find it now.
I am using absoluteposition.


it was something like this:

Code: Select all


z=node.getpostion(core_vector3df(.x .y .z))


Could post the correct code .

Thank You!
Only after disaster can we be resurrected.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

You can use getAbsolutePosition, see documentation: http://irrlicht.sourceforge.net/docu/cl ... b9ead4c9a9

As you can see it returns a core::vector3df.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
speedy15453
Posts: 22
Joined: Tue Nov 09, 2010 7:03 pm
Location: ohiio

but how to i get the x,y,z values

Post by speedy15453 »

I just can't find the code to get the values for x,y,z .
I understand it is core_vector3df. I need to check the values to find out where the node is in world positions after I make rotations to the node.
Only after disaster can we be resurrected.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: but how to i get the x,y,z values

Post by Seven »

speedy15453 wrote:I just can't find the code to get the values for x,y,z .
I understand it is core_vector3df. I need to check the values to find out where the node is in world positions after I make rotations to the node.
it RETURNS a vector3df, it does not modify variables that you pass in.

Code: Select all


if (node)
{
    // get the position of the node and store the values in the variable named pos 
    vector3df pos = node.getPosition();

    // print out the values of the variable named pos
    printf("Node is at position (%f %f %f)\n",pos.X,pos.Y,pos.Z)); 
} 
else printf("Node is not valid\n");

speedy15453
Posts: 22
Joined: Tue Nov 09, 2010 7:03 pm
Location: ohiio

Maybe it's just my IDE

Post by speedy15453 »

I can't get it to work using my IDE (realbasic with Irrlicht plugin "franklin3d")

Code: Select all

      node1.updateAbsolutePosition  ' works
      pos2 = node1.getAbsolutePosition() 'works
      printf("Node is at position (%f %f %f)\n",pos2.X,pos2.Y,pos2.Z)) '"this method or property does not exist" 
      ' I tried different variations and nothing. 
anyother sugestions?
Only after disaster can we be resurrected.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Maybe it's just my IDE

Post by Seven »

speedy15453 wrote:I can't get it to work using my IDE (realbasic with Irrlicht plugin "franklin3d")

Code: Select all

      node1.updateAbsolutePosition  ' works
      pos2 = node1.getAbsolutePosition() 'works
      printf("Node is at position (%f %f %f)\n",pos2.X,pos2.Y,pos2.Z)) '"this method or property does not exist" 
      ' I tried different variations and nothing. 
anyother sugestions?
the printf function isnt required for what you want to do, it was just an example for you to understand how the vector3df works. just use the values hwoever you need.

vector3df pos = node->getPosition();

do something with

pos.X
pos.Y
pos.Z
speedy15453
Posts: 22
Joined: Tue Nov 09, 2010 7:03 pm
Location: ohiio

Thank You

Post by speedy15453 »

With my plug in I hve to use the following code:

Code: Select all

pos.x_
pos.y_
pos.z_
Only after disaster can we be resurrected.
Post Reply