• Create Account

### #ActualMedo3337

Posted 19 December 2012 - 01:36 PM

Here is what I use to move the capsule forward:
D3DXMATRIX matRot;
D3DXMATRIX ZUnitVec;
D3DXVECTOR3 vecForward;
D3DXMatrixTranslation(&ZUnitVec, 0.0f, 0.0f, 1.0f);  // Matrix holding position of vector pointing to positive z
D3DXMATRIX m = ZUnitVec * matRot;
vecForward = D3DXVECTOR3(m._41,m._42,m._43); // Get vector from the matrix

X -= (elapsedTime * speed) * vecForward.x;
Y -= (elapsedTime * speed) * vecForward.y;
Z -= (elapsedTime * speed) * vecForward.z;

// -- Move btCapsuleShape forward
body->translate(btVector3(X - trans.getOrigin().getX(), Y - trans.getOrigin().getY(), Z - trans.getOrigin().getZ()));


How can I fix it to make the capsule move normally on the heights?

### #1Medo3337

Posted 19 December 2012 - 01:36 PM

Here is what I use to move the capsule forward:
D3DXMATRIX matRot;
D3DXMATRIX ZUnitVec;
D3DXVECTOR3 vecForward;
D3DXMatrixTranslation(&ZUnitVec, 0.0f, 0.0f, 1.0f);  // Matrix holding position of vector pointing to positive z
D3DXMATRIX m = ZUnitVec * matRot;
vecForward = D3DXVECTOR3(m._41,m._42,m._43); // Get vector from the matrix

X -= (elapsedTime * speed) * vecForward.x;
Y -= (elapsedTime * speed) * vecForward.y;

Z -= (elapsedTime * speed) * vecForward.z;

// -- Move btCapsuleShape forward
body->translate(btVector3(X - trans.getOrigin().getX(), Y - trans.getOrigin().getY(), Z - trans.getOrigin().getZ()));


How can I fix it to make the capsule move normally on the heights?

PARTNERS