Problem with the mesh inclination

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
mr.xyz
Posts: 7
Joined: Wed Aug 25, 2010 3:16 pm

Problem with the mesh inclination

Post by mr.xyz »

Hello,

I succeed in having the normal of a plan, to inclinate my mesh, like this :

Code: Select all

// 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 :wink:
Last edited by mr.xyz on Fri Sep 03, 2010 5:43 pm, edited 2 times in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You wrote that you succeeded. This usually means that everything is ok. Please describe your problem.
benjani13
Posts: 25
Joined: Sat Aug 07, 2010 8:12 pm

Post by benjani13 »

[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^^

Tu veux faire quoi exactement?
mr.xyz
Posts: 7
Joined: Wed Aug 25, 2010 3:16 pm

Post by mr.xyz »

[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 ;)
mr.xyz
Posts: 7
Joined: Wed Aug 25, 2010 3:16 pm

Post by mr.xyz »

Up please :)

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 :)
mr.xyz
Posts: 7
Joined: Wed Aug 25, 2010 3:16 pm

Post by mr.xyz »

Up please !
booe
Posts: 76
Joined: Thu Jul 29, 2010 2:12 pm

Post by booe »

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!
mr.xyz
Posts: 7
Joined: Wed Aug 25, 2010 3:16 pm

Post by mr.xyz »

booe wrote:
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!
AHAHAH AHAH HAH ... :roll:
stefbuet
Competition winner
Posts: 495
Joined: Sun Dec 09, 2007 4:13 pm
Location: france

Post by stefbuet »

Tu viendrais pas du SdZ par hasard ?
J'avais répondu à une personne qui avait un problème très similaire, ICI :
http://www.siteduzero.com/forum-83-5345 ... l#r5243460

Eh bien si, c'est toi, encore un problème ?!
Tu a écrit "résolu", non? :roll:
Steel Style
Posts: 168
Joined: Sun Feb 04, 2007 3:30 pm
Location: France

Post by Steel Style »

He didn't not suceed apparently as you may see it's the same code as the french forum.
mr.xyz
Posts: 7
Joined: Wed Aug 25, 2010 3:16 pm

Post by mr.xyz »

I didn't suceed, in fact i forgot to change the french topic's status..

I suceed to have the normal of the terrain face in contact with the mesh, but i don't suceed to incline my mesh with it :(
Post Reply