Sign in to follow this  
maxam

OpenGl and physics question

Recommended Posts

Lets say you have a falling box, it falls on one of its corners. I have a general idea of how the simulation would work but my question is how it the box's (or different object) mesh data handled? Is every vertex transformed with its rotation and translation then put into some array for processing or is it handled differently. I just started coding a simple physics plugin for my engine (opengl renderer) so please forgive me if this is a stupid question. Also if you know of any tutorials or simple demos with source that would be a big help. -Nomad-

Share this post


Link to post
Share on other sites
I think you are looking for a translation matrix in openGL. a 4x4 matrix would be projected over the whole object. you shouldn't have to go through an array and apply the change yourself openGL will do it for you. you have to calculate the forces on the cube after the colision and then put them in terms of acceleration, or velocity and then apply then to the idenity matrix based off of the time it takes to render each frame. this way the velocitys units are in units/sec instead of units/frame.

Share this post


Link to post
Share on other sites
I know how to do rotations and stuff in opengl. But lets say a corner of the box hits something, how do i know where the vertex's are ( for collision/response ). Once you apply a transform and draw the object, opengl takes over and transforms your input data and draws it without changing the original data.

Share this post


Link to post
Share on other sites
Quote:
Original post by maxam
I know how to do rotations and stuff in opengl. But lets say a corner of the box hits something, how do i know where the vertex's are ( for collision/response ). Once you apply a transform and draw the object, opengl takes over and transforms your input data and draws it without changing the original data.
You have to maintain and manage the transformed geometry yourself. Technically speaking there may be some duplicated effort, but there are various ways to keep the geometry that must be transformed manually to an absolute minimum. Also, many simple shapes (such as boxes) can be represented implicitly and don't require any vertex transformations at all, per se.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this