[need an advice] How to set the position of a mesh

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
Konstantin
Posts: 12
Joined: Fri May 18, 2007 3:06 pm
Location: Panketal, Germany

[need an advice] How to set the position of a mesh

Post by Konstantin »

Hi,

I've a problem with changing the position of meshes. In the tutorials there's allways used ''SetPosition()''.
But when i modify some parameters of that function, nothing changes.(?)

Is that the right function? Or is there another way to set the position of a mesh?

Thank you for answers and advices.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

setPosition acts on SceneNodes. A Mesh does not have a position.
kennypu666
Posts: 26
Joined: Thu Apr 26, 2007 6:57 am

Post by kennypu666 »

make ur scenenode first. ex:

Code: Select all

 
ISceneNode* wutevernode = loading ur mesh;

wutevernode->getposition(core::vector3df(0.0f,0.0f,0.0f); //vector3df(x,y,z)

Konstantin
Posts: 12
Joined: Fri May 18, 2007 3:06 pm
Location: Panketal, Germany

Post by Konstantin »

Thanks for that tip but it doesn't :?

It only says
'getposition': Isn't a element of 'irr::scene::ISceneNode' :x

What's my mistake? Please help.
THX
vi-wer
Posts: 93
Joined: Sun May 20, 2007 7:15 pm
Location: Germany
Contact:

Post by vi-wer »

getposition is wrong written. it has to be getPosition.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, it has to be setPosition(core::vector3df(x,y,z));
Konstantin
Posts: 12
Joined: Fri May 18, 2007 3:06 pm
Location: Panketal, Germany

Post by Konstantin »

Hybrid? Would you give me a little example pls?

THX Konstantin

PS: Is there a RTS-Camera in the engine?
Konstantin
Posts: 12
Joined: Fri May 18, 2007 3:06 pm
Location: Panketal, Germany

Post by Konstantin »

I've made the code like this:

Code: Select all

       scene::IAnimatedMesh* mesh = smgr->getMesh(
		"../../media/beast.x");
	
	scene::IAnimatedMeshSceneNode* anode = 0;
	anode = smgr->addAnimatedMeshSceneNode(mesh);
	anode->setPosition(core::vector3df(0,0,0));
	anode->setAnimationSpeed(20);
	anode->setScale(core::vector3df(100,100,100));
	anode->setMaterialFlag(video::EMF_NORMALIZE_NORMALS,true);
But even if i modify the 'setPosition'-Values to 1000,1000,1000 the mesh stays there where it is now.(?)
Georgian
Posts: 60
Joined: Sat Mar 31, 2007 12:55 pm

Post by Georgian »

maybe because of large scale 1000 deosnot seem to move.. it happened to me once try larger numbers like 1111989
using Visual Studio 2003 , I use 3D Max 7, I love irrlicht its a really good and easy engine
Konstantin
Posts: 12
Joined: Fri May 18, 2007 3:06 pm
Location: Panketal, Germany

Post by Konstantin »

Thanks! Now everything works!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, you might not notice a move of 1000 units if your mesh is 100*original size which is probably much larger than 10 units. Your code should work (although you might have to call updateAbsolutePosition of you use Irrlicht 1.2 or earlier just after setting the position).
Post Reply