Historique des modifications - Message

Message #11588

Sujet: Gestion du ragdoll [sous bullet] avec l'animation


Type Date Auteur Contenu
Création du message 11-04-2015 11:48:19 Magun
si c'est pour un personnage btKinematicCharacterController

Code c++ :


            shape = new btCapsuleShape(width, height);

            ghost = new btPairCachingGhostObject();
            ghost->setActivationState(DISABLE_DEACTIVATION);
            ghost->setCollisionShape(shape);
            ghost->setUserPointer((void*)(this));

            character = new btKinematicCharacterController(
                ghost, (btConvexShape*)shape,
                btScalar(box.getExtent().Y/5)
            );

update:

Code c++ :


                irr::u32 time = phy->getEnityManager()->getDevice()->getTimer()->getTime();
                irr::f32 DeltaTime = (time-TimeStamp) / 500.0f;

                btTransform &xform = m_ghost->getWorldTransform();
                btMatrix3x3 &orn = xform.getBasis();

                orn *= btMatrix3x3(
                    btQuaternion(
                        {0,1,0},
                        DeltaTime*(m_rotateLeft-m_rotateRight)
                    )
                );

                btVector3 forwardDir = orn[2].normalize();
                btVector3 strafeDir = orn[0].normalize();

                btVector3 walkDirection;

                walkDirection = strafeDir*(m_strafeRight - m_strafeLeft)*0.5f;
                walkDirection += forwardDir*(m_forkward - m_backward);
                character->setWalkDirection(walkDirection*speed);

                TimeStamp = time;


note btCapsuleShape pour un personage, c'est mieux pour les escaliers ...
sinon tu peut jouer avec setInterpolationLinearVelocity mais c'est moin bien

Retour

Options Liens officiels Caractéristiques Statistiques Communauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1440 sujets
11337 messages
Dernier membre inscrit: Saidov17
153 invités en ligne
membre en ligne: -
RSS Feed