Properties in body or rigid body?

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

Recommended Posts

Hi [smile] I don't know how split a body's properties between my IBody3D interface and my IRigidBody3D interface. Firstly, here are the interfaces:
[System.CLSCompliant(true)]
public interface IBody3D
{
/// <summary>
/// Position of the 3D body in world space.</summary>
Vector3 Position {get; set;}
/// <summary>
/// Orientation of the 3D body in world space.</summary>
Quaternion Orientation {get; set;}

//Linear
Vector3 Velocity {get; set;}
Vector3 Acceleration {get; set;}
//Angular
Vector3 VelocityAngularBody {get; set;}
Vector3 AccelerationAngularBody {get; set;}
Vector3 VelocityAngular {get; set;}
Vector3 AccelerationAngular {get; set;}

IntegrationFlags IntegrationFlags {get;}
}

[System.CLSCompliant(true)]
public interface IRigidBody3D : IBody3D
{
//Linear
float Mass {get;}
//Angular
Matrix InertiaBody {get;}
Matrix InertiaBodyInverse {get;}

//Sphere in world space
Sphere BoundingSphere {get;}

void CalculateObjectForces(out Vector3 forces, out Vector3 momentsBody);
bool CanBeCollidedWith(IRigidBody3D candidate);
void NotifyCollision(IRigidBody3D collidee, CollisionData3D collisionData);
}


Actually, could Mass go into body? Since a non-rigid body could be deformable, I put the inertia matrices into the rigid body - is that right? Thanks

Share on other sites
Why do you have two classes for the same thing in the first place? Why inherit part of the data?

If you want to split bodies in soft bodies (clothes), and rigid bodies, is the mass, acceleration, iertia, velocity relevant?

Share on other sites
It isn't bad, but it would better if you try to separate static properties from dynamic properties of your body.

Static properties are: Mass, Inertia, bounding shape, geometry, etc.

Dynamic properties are: position, orientation, velocity, angular velocity,forces,torques etc. Everything that changes with time.

That is useful if you want to simulate a large stuff of particles, those have the same mass and geometry, but each one has diferent position and velocity.

Share on other sites
Thanks for the replies...I want to really be able to pass my IBody3D into my numerical integrator and use my IRigidBody3D interface in my rigid collision detection/response.

I suppose you could say just put everything your integrator uses into IBody3D but I don't know how applicable something like an inertia matrix is for soft bodies.

Thanks

Share on other sites
Inertia matrix is for rotations, as mass is for linear velocities. It allows you to know how much resistance the body gives when a torque applies on it for movement.

Your Body3D isn't clear. Which its goal? Why don't implement a singleton rigid body class?

Share on other sites
They are interfaces which define the properties and methods of implementors (I'm using C#)

Thanks + rates

EDIT: in case you come from C++, interfaces are like abstract classes where (not sure on C++ terminology) everything would be pure virtual
I basically use them to separate the logic (integration etc) from the actual objects so I can make several, implement the interface for each and use them together.

[Edited by - DrGUI on July 20, 2005 3:30:58 PM]

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633704
• Total Posts
3013460
×