Trying out Newton Dynamics...

BlitzMax Forums/MiniB3D Module/Trying out Newton Dynamics...

SLotman(Posted 2011) [#1]
I'm trying my hand with Newtown on miniB3D - but haven't got very far :(

The thing is - I have everything set up, and apparently working; I can move objects with "NewtonBodySetVelocity" - they move, rotate and collide with each other.

But no matter what I do, I can't get objects to fall using gravity. It's like they're floating in space or something! Trying "NewtonBodySetForce" does absolutely nothing...

Anyway, here is the code I'm using:


To test it, you're going to need these files (the newton.a files were taken from Warner's engine, as the inc/newton.bmx):

http://www.icongames.com.br/temp/newton-minib3d.zip

Can anyone tell me what I'm doing wrong here?

Last edited 2011

Last edited 2011


SLotman(Posted 2011) [#2]
Hmmm... manage to get it working adding a callback.

Still have some problems to iron out - I'm trying to move the cube changing it's velocity, but somehow while I'm moving it, it doesn't fall again :(


SLotman(Posted 2011) [#3]
So... this is the best I could come up with:



It seems to be working... but when I just move the red cube left/right it turns itself with no apparent reason. Is this right? Do I have to set somehow some friction value so it won't spin?

Also, I would love some other way to move the body - specially without acceleration. I was using NewtonSetVelocity in the main loop, but that would just remove the gravity every time I hit any key to move around...

Anyone can help? Give any insight?


Kryzon(Posted 2011) [#4]
Klepto2 has made a functional Newton module: http://code.google.com/p/minib3dextended/ - you can use it as reference.