Problem setting new position of node (C#)

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
kawash
Posts: 2
Joined: Wed Oct 04, 2006 1:44 pm

Problem setting new position of node (C#)

Post by kawash »

Hi all,

I'm beginner with IRRLICHT.NET. I'm trying to tranlate my c++ project into C#. All its ok except :

Here the original code (written in C++). This code works :

Code: Select all

mesh = smgr->getMesh("model/grappin.x");
node2 = smgr->addAnimatedMeshSceneNode( mesh );
node2->setPosition(vector3df((float)0.2,(float)-0.1,(float)-1)); // setting new position of my node
Here the translation into C# :

Code: Select all

IAnimatedMesh grapin = smgr.GetMesh(@"model\grapin.x"); // it works
 IAnimatedMeshSceneNode node2 = smgr.AddAnimatedMeshSceneNode(grapin, null, 0); // it works ^^ 

node2.Position.Set(new Vector3D(0.2f, -0.1f, -1.0f));  // here is the problem :( 

i've tryed a lot of random values for X,Y,Z ... but nothing my node stay in the same place i dont know why :(
Is it the right instruction?

Thanks to help me and sorry for my bad english ^^

Regards
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

node2.Position = new Vector3D(X, Y, Z);

What you are doing is just modifying the value of a vector which is not your node's position but has the same values.

What does it mean ? It means you can't act on your node's position this way, you must always do :
Vector3D vect = node2.Position;
//Operations on vect, such as "vec.Set(X, Y, Z)"
node2.Position = vect;
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
kawash
Posts: 2
Joined: Wed Oct 04, 2006 1:44 pm

Post by kawash »

nice it works perfectly!

thanks a lot :D
Locked