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);
}