// Rotations in X and Z (for the terrain)
// Refresh
modelPosition = _model->getPosition();
modelRotation = _model->getRotation();
verticalLine.start = antPosition;
verticalLine.end = antPosition;
verticalLine.start.Y += 1000;
verticalLine.end.Y -= 1000;
selectedSceneNode =
collMan->getSceneNodeAndCollisionPointFromRay(
verticalLine,
intersection,
HitTriangle,
IDFlag_IsPickable, // This ensures that only nodes that we have set up to be pickable are considered
0); // Check the entire scene (this is actually the implicit default)
if(selectedSceneNode != 0)
{
if(HitTriangle != lastHitTriangle)
{
/* This section doesn't work. I've tried with quartenions too, but not works too...
lastHitTriangle = HitTriangle;
core::vector3df normal = HitTriangle.getNormal().normalize();
core::vector3df newModelRotation = modelRotation;
newModelRotation.X = atan2(normal.Z,normal.Y)*core::RADTODEG;
newModelRotation.Z = -atan2(normal.X,normal.Y)*core::RADTODEG;
_ant->setRotation(newAntRotation);
*/
}
}
Edit : I want to incline my mesh in X and Z in function of a irrlicht-generated terrain.
Sorry if you don't understand something, I'm french and my english is not very good
Last edited by mr.xyz on Fri Sep 03, 2010 5:43 pm, edited 2 times in total.
[This message is in French, to help mr.xyz who are French and have some difficulties with English]
mr.xyz, je pense que je vais pouvoir t'aider niveau compréhension, niveau math c'est pas sur^^
[I want to incline a mesh in function of a irrlicht-generated terrain. My mesh is like a car, it's a ant by the way. So I succeeded in having the terrain's normal in the ant position. I success to incline my mesh in the Y axis (for the direction) but no in the X and Z axis (for the inclinaison).]
Thanks and sorry for my english x)
J'aimerais incliner un mesh suivant un terrain généré par irrlicht. Mon mesh est une fourmi, j'ai réussi à récupérer la normale du terrain à l'endroit ou se situe la fourmi. J'arrive à incliner ma fourmi en Y (pour la direction), mais pas à l'incliner en X et Z. Merci d'avance
Excuse me for my english, i can't find how to make pitch and roll for my mesh, I searched that on a lot of forums but nothing ... I you have some links please
benjani13 wrote:[This message is in French, to help mr.xyz who are French and have some difficulties with English]
vous peu que je suis heureux de vous aider à gérer moi marmite vous obtenez un vecteur normal perpendiculaire à l'appendice auriculaire à la surface de thé à Téhéran, qui cuisent à une prune robe de la fourmi voiture qui est sur la terre parce que je n'aime pas une bonne année pour le calcul de l'ustensile. comme les bouilloires!
benjani13 wrote:[This message is in French, to help mr.xyz who are French and have some difficulties with English]
vous peu que je suis heureux de vous aider à gérer moi marmite vous obtenez un vecteur normal perpendiculaire à l'appendice auriculaire à la surface de thé à Téhéran, qui cuisent à une prune robe de la fourmi voiture qui est sur la terre parce que je n'aime pas une bonne année pour le calcul de l'ustensile. comme les bouilloires!