Properties in body or rigid body?

Started by
4 comments, last by DrGUI 18 years, 9 months ago
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
Advertisement
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?

Everything is better with Metal.

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.
"Technocracy Rules With Supremacy" visit: http://gimpact.sourceforge.net
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
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?

"Technocracy Rules With Supremacy" visit: http://gimpact.sourceforge.net
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]

This topic is closed to new replies.

Advertisement