Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

No rotations in my 3d rigidbody system???

$
0
0

In my 3d rigid-body simulation, when the ball hits an object it doesn't get rotated. I'm using AABB for collision detection

 this is how i update the objects

void RigidBody::Update(float h)
{
	x += h*v;
	v += h*(F_Total/Mass);
	q += 0.5f*h*Omegaq;
	L += h*Tau_Total;
	q = XMQuaternionNormalize(q);
	R = XMMatrixRotationQuaternion(q);
	IInverse = XMMatrixMultiply(XMMatrixTranspose(R), IBodyInverse);
	IInverse = XMMatrixMultiply(IInverse, R);
	Omega = XMVector4Transform(L, IInverse);
	F_Total = XMVectorSet(0, 0, 0, 0);
	Tau_Total = XMVectorSet(0, 0, 0, 0);
	UpdateAABB();
}

This is how add impulsive torque and torque to the system

void RigidBody::AddTorque(XMVECTOR Torque)
{
	Tau_Total += Torque …

Viewing all articles
Browse latest Browse all 17560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>