Physics

Blitz3D Forums/Blitz3D Beginners Area/Physics

fox95871(Posted 2009) [#1]
Hi, I'm starting work on physics for my game. I want it to look as good as the mushrooms in Newtonian Mario 64 but I don't know where to start really. I'm getting a bunch of mhts today to look over at home, but I can't help thinking most of them won't be as good as the above mentioned - perfect - program. I really want mine to look that good. I want the sphere to bounce down the stairs in a totally believable way, bouncing off in directions based on the last surface hit, so if you hit an even stair, it will bounce basically forward, and if you hit a stair that's crookedly turned towards the wall it will bounce that way and hit the wall.



Please help if you can. I can't believe I have to have some special external dll to do this. I'll use one if that's what it takes, but I'd like to do it with pure Blitz3D if I can.


WERDNA(Posted 2009) [#2]
I'll download this when I get a chance :)

I doubt though that I have the skills to help out with physics.
I am not overly experienced in 3D.
(Although I might be able to help out with bits of this, and make it
easier for someone more experienced then I to help you out)


Good luck!

WERDNA


Yasha(Posted 2009) [#3]
If you don't mind doing it via userlib, you could consider ODE. It's fast, and very stable if you get the better version (although that one isn't free). (EDIT: Oh, and this one is free too...)

if you really want to do it yourself within B3D, read this article, but be warned that this method is generally slower and less accurate, and completely useless for things like rolling balls, although it does relatively well on objects with clearly-defined corners. There are a few examples floating around the site of this method in use (mostly by Pongo and StevieG).


GIB3D(Posted 2009) [#4]
You can download PhysX (also called [Phi]sics) on xors3d.com for free, but there are things you can unlock by buying it.

-PhysX / [Phi]sics
-PhysX Samples


Stevie G(Posted 2009) [#5]
You don't need a physics engine for this. To start you off, this function can be used for proper bounce as you describe it:

http://www.blitzbasic.com/codearcs/codearcs.php?code=670

Note that in the following lines you can play with the cooef of restitution by changing the 2 to a figure between ( 1 and 2 ) , where 1 = inelastic, 2 = elastic.

NFx# = -2.0 * Nx# * VdotN# 
NFy# = -2.0 * Ny# * VdotN# 
NFz# = -2.0 * Nz# * VdotN# 



Matty(Posted 2009) [#6]
What's the black square?


fox95871(Posted 2009) [#7]
The character placeholder. Wow, thanks for all the suggestions! Last night I looked over about half the two threads on the vertlet method. Then I was about to fall asleep, so I just skipped to the end of this thread, copied and pasted the code, swapped the ground mesh with a more bumpy one, and tried it out... and the object was reacting to the different angles of the mesh! There's still some work to do, changing it from a puck to anything else makes everything go haywire, and once I do get it to be a sphere like I need, then I have to find out what controls bounce, cause it has to have quite a bit more. But otherwise it looks like it'll work, hitting the crooked stairs and going off in other directions hopefully. Looks like the verlet threads were a big deal about a year ago. If someone involved back then wants to point out what parts of the code would help me modify the things I mentioned, I'd be really grateful. Til then I'm going to try out all the suggestions you gave. Thanks so much!


fox95871(Posted 2009) [#8]
The black square's a screenshot, I forgot some browsers don't show pngs right. I've turned it into a jpg. I tried JV-ODE last night. No, I'm not giving up. I don't have the money for it anyway. But it was nice to see that Newtonian Mario 64 isn't the only Blitz3D program that got the physics right. This was also my first time trying a dll. I didn't realize they were so easy to set up. Just put them in a folder and Blitz3D acts like their functions are its own. Not sure I trust that, but other people seem to, so I won't worry about it too much. I'm going to try the free one, [Phi]sics, tonight. Hopefully the extras you have to pay for won't be anything I need. Stevie, I tried the bounce code you suggested, but I don't think I did it right. I changed "entity" to "sphere" and tried putting the code in different places, but nothing happened. I tried changing the gravity, and lifting the sphere and dropping it back down again, but there was no bounce, at an angle or otherwise. Do you really think it'll do what I want? Sorry I'm not a master coder, but I'm trying.


fox95871(Posted 2009) [#9]
I'm pretty happy with BlitzODE now and no longer plan to reinvent the physics. Thanks for all the suggestions though, I wouldn't have tried them all out otherwise.


Nate the Great(Posted 2009) [#10]
hey fox, uh that code from this thread is really a mess but it works and thats what counts if you want to use it. Haha I forgot how it works now :p The verlet structures are really sensitive in that particulare implementation. I dont really know why. but I did manage to get a few spheres rolling down some terrain after a long time!


fox95871(Posted 2009) [#11]
Whatever, your name is forever set in stone as far as I'm concerned for your work on http://blitzbasic.com/Community/posts.php?topic=82090#1057568 and http://blitzbasic.com/Community/posts.php?topic=84178#952565. I don't suppose you could work your magic again for http://www.blitzbasic.com/Community/posts.php?topic=87347#1057590 could you? No one's replied yet, and I really need the help.

Last edited 2010


Nate the Great(Posted 2009) [#12]
sorry, I dont have blitzODE so I dont know exactly what you are talking about but ill look at it.


Cubed Inc.(Posted 2010) [#13]
it has a virus


Nate the Great(Posted 2010) [#14]
what has a virus? I dont see any downloads....


Charrua(Posted 2010) [#15]
there is a free miniode lib by yasha, take a look
it icludes a dll and some examples of use, i been working on a editor for it an for ode, there is more info on this thread:

http://blitzbasic.com/Community/posts.php?topic=89067


Juan