Advertisement

What would you do on this parametized animation?

Started by November 28, 2017 03:14 AM
4 comments, last by Scouting Ninja 7 years, 2 months ago

When the vehicle moves back, there are two options. 1st) Move to the left 2nd) Move to the right... and you have a standard animation for moving back, you could scale it if you want. But what would you do to deal with this variety of move-backs, do you 1st) create 2 different animations, one for the left and one for the right, OR, just bake one animation and give a factor to determine it is left or right, all the times, I could have created a cross product with the direction of the object with the up vector of the object and multiply it by a left-right factor...

What is the preferred way for you?

Thanks

Jack

For a vehicle backing up?  There are two possibilities as the front wheels only turn left/right.  Play the wheel steering animation and change the rotation of the wheels for reverse and move the vehicle back.  Never really seen vehicle movement animation, typically physics took care of it.

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

Advertisement
4 hours ago, lucky6969b said:

What is the preferred way for you?

Wouldn't use a animation for this. Animations is too limiting.

I would create a rig in the Game Engine that turns the wheels using variables. It's more complicated but the performance would be better and it would look more realistic in the end.

Hello Scouting Ninja and Mike,

Maybe I look into the rig thing later, but now my "customized" animation looks quite good... the only one thing is I can't really name or tag a key...

For example, the moveback animation set comes from an animation factory,  there are 4 keys, at

0,0,0 -> -2,0,0 -> -2,0,0 -> -2,0,-2

no rot->no rot-> turn 1.57->turn 1.57

Notice it's a relative animation set, so it is relative to the origin.

The problem with this now it is turning right, how do I make it turn left

You can negate the rotations, and also negate the translations, despite of the first key...

Without naming it, I can't really tell


	if (pAnimSet)
        {
            Transform* l_transform = FindComponentByType<Transform>();
            DOUBLE pCurTime = m_pAnimController->GetTime();
            DOUBLE pPeriodPos = m_pMoveBack->GetPeriodicPosition(pCurTime);
            D3DXVECTOR3 s, p;
            D3DXQUATERNION r;
            pAnimSet->GetSRT(pPeriodPos, 0, &s, &r, &p);
	            p *= 0.5f;
	            //TRACE("Trans is " << p.x << " " << p.y << " " << p.z);
	            D3DXMATRIX matTrans;
            D3DXMatrixTranslation(&matTrans, p.x, p.y, p.z);
            D3DXMATRIX matRot;
            D3DXMatrixRotationQuaternion(&matRot, &r);
            
            // Now we have a world matrix done
            // And we add onto the matrix
            D3DXMATRIX matFinal;
            matFinal = matRot;
            D3DXMATRIX* l_pWorld = l_transform->getWorldMatrixPtr();
            matFinal *= *l_pWorld;
            matFinal *= matTrans;
            *l_pWorld = matFinal;
        
        }
	
On 11/30/2017 at 6:49 AM, lucky6969b said:

The problem with this now it is turning right, how do I make it turn left

That should be the inverse of turning it right shouldn't it. X-1;

0,0,0 -> -2,0,0 -> -2,0,0 -> -2,0,-2   Should be 0,0,0 -> +2,0,0 -> +2,0,0 -> +2,0,+2

Honestly without seeing what your doing I don't think I can help more. Maybe a show us how your making the animation and how it works.

This topic is closed to new replies.

Advertisement