# Starting With Physic

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

## Recommended Posts

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?

##### Share on other sites
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.

##### Share on other sites
That sure was an interesting read, not easy though as you said. Thanks for that anyways.

1. 1
2. 2
Rutin
19
3. 3
khawk
19
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633771
• Total Posts
3013761
×