Mess with ISceneNode? and setPosition? [SOLVED]

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
anirul
Posts: 30
Joined: Wed Oct 07, 2009 6:03 am
Location: Geneva
Contact:

Mess with ISceneNode? and setPosition? [SOLVED]

Post by anirul »

Hi all,

My project is getting near playability, but I have a weird effect that I cannot explain so any idea is welcome! In my project the player is clicking on a planet, and as soon as he clic (plus a number of condition that are usually ok) I put a new ISceneNode at the clic position with a mesh, actually a IAnimatedSceneNode.

Now my problem is if the X coordinate in my position is negatif or 0 nothing is displayed! I m sure this is something really stupid, and I will probably solve it but in case someone has a hint?! Here is the code that add and display the mesh

Code: Select all

void plant::add(
	plant_mesh_type pmt,
	irr::scene::ISceneNode* parent,
	irr::scene::ISceneManager* mgr)
{
	if (m_pmt == pmt) return;
	m_pmt = pmt;
	// remove the old one from the tree (if any)
	remove();
	m_plant_node = mgr->addAnimatedMeshSceneNode(
		s_plant_mesh[pmt],
		parent);
	irr::core::vector3df scale(
		parameter_set::instance()->getValueDouble(
			"biolite.plant.mesh.scale.X"),
		parameter_set::instance()->getValueDouble(
			"biolite.plant.mesh.scale.Y"),
		parameter_set::instance()->getValueDouble(
			"biolite.plant.mesh.scale.Z"));
	m_plant_node->setScale(scale);
	irr::core::quaternion quat;
	irr::core::vector3df from(0.0f, 1.0f, 0.0f);
	irr::core::vector3df to(m_position);
	to.normalize();
	from.normalize();
	quat.normalize();
	quat.rotationFromTo(from, to);
	irr::core::matrix4 mat;
//	mat = quat.getMatrix();
	mat.makeIdentity();
	mat.buildRotateFromTo(from, to);
	m_plant_node->setRotation(mat.getRotationDegrees());
	m_plant_node->setPosition(m_position);
}
Thanks in advance!
Last edited by anirul on Fri Aug 06, 2010 9:36 am, edited 1 time in total.
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

It would be hard to say from the code you gave us, you should write a minimal working example that would reproduce the same problem.
Working on game: Marrbles (Currently stopped).
anirul
Posts: 30
Joined: Wed Oct 07, 2009 6:03 am
Location: Geneva
Contact:

Post by anirul »

this should be doable but I m afraid that the code would be kinda big...
Ravi08
Posts: 249
Joined: Thu Jul 17, 2008 12:25 pm

Post by Ravi08 »

Hi anirul,

I think to give us a bit more info u should post how you are getting the mouse position.
"Hey Baby Wobbling Wobbling"
-Russell Peters
anirul
Posts: 30
Joined: Wed Oct 07, 2009 6:03 am
Location: Geneva
Contact:

Post by anirul »

my own stupidity like usual (some mistake in the logic code)
Post Reply