Sign in to follow this  
binary_bandit

How to structure a program

Recommended Posts

binary_bandit    132
Hiya, Ive been messing about with Nehe's particle program, its pretty cool, I can follow it and its quite a cool way of doing things. However I would like to be able to use something like this and then place objects near the flow and build in collision detection so that the particles fly off in an appropriate direct. The physics and mathematics of this I understand and i can do in my sleep :-) However I was just woundering as my programming isnt that great how one would go about detecting the impacts of all these particles at any one time, and how you might provide each particle with collision detection? I've used C for all my development until now, however I think that prehaps if i take an object orientated approach this might help me? sorry im a n00b to programming like this. Was just after some guidance on how to proceed in really simple english :-) cheers David

Share this post


Link to post
Share on other sites
cyberquiet    139
Sorry, I don't understand what you're looking for.
Do you alredy know what to do, but you don't know what's the best way to code it, or are you asking for a way to do add collision detection to a particle system?
Maybe you're asking for both... 8-)

Share this post


Link to post
Share on other sites
RobTheBloke    2553
I'm wondering if this might be the answer you are after (with the full question)...

You know the maths, but it seems like the only method you can think of seems to be really long winded? err, unfortunately that long winded method is going to be correct. :(

Basically apply those maths equations you know so well to that data and it will do what you expect - The nehe example is a basic example to get started with, to get a really nice fully fledged physics engine requires a very large amount of code....

OOP programming techniques may improve the readability of the code, but it wont make the problem any easier unfortunately.

I'd probably suggest having a look at some of the physics engines currently out there before you start, ie ODE, Karma, Havok, Novadex, Tomahawk, Newton....

It might help guide you as to the overall design of the code needed (though don't expect the code to be easy since the problem is not easy to solve).

Share this post


Link to post
Share on other sites
James Trotter    432
Quote:
Original post by binary_bandit
I've used C for all my development until now, however I think that prehaps if i take an object oriented approach this might help me? sorry im a n00b to programming like this.


Surely, if you're used to coding in C, then trying to learn an object oriented language to solve the problem in an object oriented way for the sake of being object oriented won't help you in the least.

You might want to start simple. Begin by making a plane beneath the particles, then have the particles collide with the plane, bouncing off it.

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