"Physics" tech demo :P

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

"Physics" tech demo :P

Post by kattle87 »

This is what can be done using differential equations :P (Newton's equations)

No collision of course, it's a simple demo. You can press "2" for changing the scene. I will be updating it in some days :D and I will also post the code. Bye bye!
Attachments
running ball.zip
(30.96 KiB) Downloaded 609 times
Last edited by kattle87 on Fri Jun 20, 2008 7:22 pm, edited 1 time in total.
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Francesco,

Going with math-based collision behaviors is actually allot faster in most cases then working with polygons. And as long as your accompanying procedurally generated meshes have sufficient detail ( and thus not differing much from the collision "model" ), you'll end up with a superior / more "accurate" end-result to boot.

*I had to disable my AV in order to download the file .. kkrunchy best?

K
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Actually I'm not doing any kind of collision: the ball is simply following the trajectory of a ball placed on a ground similar to one described by some equations (EG: paraboloid: Z = X^2 + Y^2)

If you can create a ground using those equations, then you can use them and their derivatives to "make the ball follow the right trajectory" in a very simple way: the ball must agree to Newton equation "F = mass * acceleration". This is actually incomplete because I'm using the ball like if it was a single massive point (so I don't care about some forces which should be present), but this is to give you the idea of what can be done: gravitational systems, balls rolling on a mathematical cliff, and so on, should be possible to recreate ;) (even if they will probably be unstable because numerical solution isn't that accurate)

BTW: yes, kkrunchy best :P
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Francesco,

Well, personally I'd categorize what you're doing under collisions. In fact, your approach ain't all that different from calculating collision data for NURBS / Surfaces. By the way, in case you're aiming to implement a full physics system, take a look at Newton :wink:

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

wow again !

nice stuff,. yes abstraction is the root of all video games. All video games are psychological tricks ;) No object in a game actualy existed, never mind collided with another imaginary object,. . much like what we call 'reality' but that is a whole other can of worms,. . fo' sure.

I was considering doing somthing like this just to get objects to move with the hight of a mesh,. (use the same math for the mesh and the z of the obj),. how you get them rolling about it beyond me,. well im sure I could suss it out, if I thought danm hard for a spell,.. but I just like to build stuff, gameplay and interesting art, mostly. My mind looses focus when the math gets all complex and abstract,. perhaps we should team up, I have a bunch of half started things what got left for lack of math to implement some gameplay or control issue.., I sure wish I had some cash to hire someone like you, to help me with the maths,. perhaps if your willing to help for free for a bit,. we can find some ways to generate an income from these games.., I know there is gold in those thar' hills! willin' to dig?
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

I have no problem helping for free. You just need to wait untill I have my exams finished. Whene you're a student you don't care about cash, you care about glory :P So no problems in helping.

BTW: for what regarding the torus (and also other parametrics) beeing with inverted normals... well it's my fault ;) but you can easy fix it by placing a "(-1)*" multiplicator in the expression regarding the Z vertex.

EG: for torus:
this.V.Z = 0.5*sin(VarV);
must become
this.V.Z = -0.5*sin(VarV);

this is the book I took formulas from for parametrics
http://books.google.it/books?hl=it&id=_ ... &ct=result
(google books preview, almost not usefull at all :D)
bye bye!
Post Reply