Starting With Physic

Started by
1 comment, last by d h k 18 years, 7 months ago
Hello everybody, I want to get started with simple physics in my OpenGL application. I spend half of the day creating a program, that allows me to create as many objects ( cubes at the moment ) and to position and rotate them easily. Now I spend the other half of the day finding any good papers / articles here and everywhere on how to start out with some simple physics. Didn't find anything useful. I would love to add gravity and collision detection against another cube. I know this is not very easy but I feel like I am up to that challenge. Let me explain what I have right now:

struct	point
{
	float	x;
	float	y;
	float	z;
};

struct	vector
{
	point	origin;
	point	destination;
};

enum physical_type
{
	SHAPE_BOX
};

class	object
{
	public:
		point			position;
		point			rotation;
		vector			force;
		physical_type	shape;

		void			draw ( float size );
};


Now I can go ahead and access the object's position rotation directly like this: cube[0].position.x += 0.5f;, which would move the cube 0 1/2 units to the right or I can rotate with cube[3].rotation.y -= 0.7f;, which would rotate the cube 3 left around the y-axis 0.7 units... But I don't have any use yet for the optional force vector and this would be the first goal I'd like to achieve - being able to adapt a certain force at keypress for example. Does anybody have any tips or links to something that could get me started?
Advertisement
The underlying math is not simple by any measure.

Physical laws are usually expressed as differential equations and to simulate physics you need to numerically solve these equations for every object.

If you don't understand the previous sentence you can either learn the necessary math or use some cookbook approach. The cookbook approach will fail once it gets more complex/interesting. For playing around it's fine though, I did it too.

For easy cookbook stuff this site did look quite ok. The links in the forum FAQ are good too.
That sure was an interesting read, not easy though as you said. Thanks for that anyways.

This topic is closed to new replies.

Advertisement