Sign in to follow this  

Mass distribution

This topic is 674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need somehow to find a mass of each point on the surface of my ships hull (that souds silly)

 

because i need to apply rotation (torque) to each individual part of the triangle (that forms a hull) (I = I0 + md^2)

 

like shown on this pic

 

mpsd.jpg

 

since i always was slicing body into smaller fragments like (cubes) i was lets say i divide one cube into smaller ones (all smaller cubes have the same dimension) so i could eaisly estimate the mass of the cube and apply that torque, now i am completely out of ideas how should i do that.

 

 

Share this post


Link to post
Share on other sites

Well torque is r x F, where r is the red vector in your picture, and F is whatever force you're trying to apply. This cross product will generate a torque that can be used to modify angular velocity. I don't think you need to use approximation or point-masses since Stan Melax open sourced the code for calculating the inertia tensor of a model given the model's triangles.

 

You can treat your boat as a rigid body with a center of mass, inertia tensor, and mass. If you'd like to apply a force at a point on the boat you can do:

 

//--------------------------------------------------------------------------------------------------

void RigidBody::ApplyForceAtWorldPoint( v3 F, v3 point )
{
    m_force += F;
    m_torque += Cross( point - m_center, F );
}

 

To integrate the linear force and torque:

 

linearVel += dt * mass * linearForce

angularVel + dt * inverseInertiaTensor * torque

 

This means you need to calculate your boats inverse inertia tensor. Code for this is up on Stan Melax's website, he has a function that takes triangles and returns the inertia tensor. The tensor is best calculated in model space of the boat, and each can be transformed to world space by: inverseInertiaTensor = R * inertiaTensor * R^T, where R is the boat's orientation matrix.

 

Links:

Melax Volint

My implementation from Melax's page and Box2D

Edited by Randy Gaul

Share this post


Link to post
Share on other sites

Randy, don't you mean:

//--------------------------------------------------------------------------------------------------
void RigidBody::ApplyForceAtWorldPoint( v3 F, v3 point )
{
    m_force += F;
    m_torque += Cross( point - m_center, F );
}

?

Yes, that bug was who knows how old :)

Share this post


Link to post
Share on other sites

This topic is 674 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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