Can I do that using Bullet Physics?
Any help will be greatly appreciated.
Edited by Medo3337, 12 November 2012 - 07:44 PM.
Posted 12 November 2012 - 02:57 AM
Edited by Medo3337, 12 November 2012 - 07:44 PM.
Posted 12 November 2012 - 07:18 AM
Posted 12 November 2012 - 08:33 AM
Posted 12 November 2012 - 04:20 PM
Posted 12 November 2012 - 07:49 PM
D3DXMATRIX matRot, matView;
D3DXVECTOR3 eye, at;
D3DXVECTOR3 up = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
D3DXVECTOR3 look = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
D3DXVECTOR3 right = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
D3DXVECTOR3 position = dynamicModel->GetPosition();
D3DXVECTOR3 rotation = dynamicModel->GetRotation();
// Rotate yaw/pitch/roll
D3DXMatrixRotationYawPitchRoll(&matRot, rotation.y, rotation.x, rotation.z);
// Transform vectors
D3DXVec3TransformNormal(&look, &look, &matRot); // Look same direction as model
D3DXVec3TransformNormal(&up, &up, &matRot); // Up same orientation as model
if (Orientation == ORIENTATION_FIRSTPERSON)
{
position.y = 15.0f;
eye = position;
at = position + 1.0f * look;
}
else
{
eye = position - 100.0f * look;
at = eye + look;
}
D3DXMatrixLookAtLH(&matView, &eye, &at, &up);
return matView;
Edited by Medo3337, 12 November 2012 - 09:01 PM.