Sign in to follow this  

What would you do on this parametized animation?

Recommended Posts

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

Edited by lucky6969b

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Edited by Scouting Ninja

Share this post


Link to post
Share on other sites

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;
        
        }
	
Edited by lucky6969b

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this