Need assistance with 2D physics project
Posted: Sat Dec 29, 2012 11:45 pm
Hi,
for the past few days I've been working on a little 2D physics "engine" that i might or might not later use for a game of some sorts. I'm also planning to port it into DirectX once i get the hang of it and physics works. This is how a "testing window" looks:
*X & Y locations are where the cube will start from
*X & Y Initial sped is, you guessed it, the speed cubes will move with when spawned
*X & Y force is acceleration that is applied constantly, similar to wind/gravity
To cut to the chase, I'm a novice/amateur programmer and have quite quickly encountered some problems. The main one is, that with ever growing code i can't seem to find the issue itself.
So I am uploading the source in hopes that someone can help me on some issues i have with it:
Gif quality is very bad but in real time it's much more fluid and you can see those 3 kind of sticking together and swirling around.
:!: If you meddle with the code on button 1 (cube creation) and cube/wall code itself you will discover some pretty nice gravity effects (GIF). I have disabled them for now, as there are issues to fix.
- if you (default setup, no speed, just Y force = 1) stack them one on top of each other they will eventually fall trough the top one (cube count - 21 - on the image is higher than the amount of visible cubes)
- cube hi detection works VERY wierdly, they might pass trough each other when force is applied, same works with cube-wall hit detection
[read post below]
for the past few days I've been working on a little 2D physics "engine" that i might or might not later use for a game of some sorts. I'm also planning to port it into DirectX once i get the hang of it and physics works. This is how a "testing window" looks:
*X & Y locations are where the cube will start from
*X & Y Initial sped is, you guessed it, the speed cubes will move with when spawned
*X & Y force is acceleration that is applied constantly, similar to wind/gravity
To cut to the chase, I'm a novice/amateur programmer and have quite quickly encountered some problems. The main one is, that with ever growing code i can't seem to find the issue itself.
So I am uploading the source in hopes that someone can help me on some issues i have with it:
Gif quality is very bad but in real time it's much more fluid and you can see those 3 kind of sticking together and swirling around.
:!: If you meddle with the code on button 1 (cube creation) and cube/wall code itself you will discover some pretty nice gravity effects (GIF). I have disabled them for now, as there are issues to fix.
- if you (default setup, no speed, just Y force = 1) stack them one on top of each other they will eventually fall trough the top one (cube count - 21 - on the image is higher than the amount of visible cubes)
- cube hi detection works VERY wierdly, they might pass trough each other when force is applied, same works with cube-wall hit detection
[read post below]