Jump to content
  • Advertisement
Sign in to follow this  
DrGUI

Properties in body or rigid body?

This topic is 4837 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

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 this post


Link to post
Share on other sites
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?

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!