Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Problem with Newton 1.53

Author
Message
Sv3 System
15
Years of Service
User Offline
Joined: 6th Jan 2011
Location:
Posted: 6th Jan 2011 11:12
Hello guys, i'm using the Newton Wrapper 1.53 but i'm having some troubles: objects fall by the gravity, but when they hit the level they just decelerate and after some frames they gets through.

Here is the code i'm using for download the level

objWorld = FreeObject()
load object "media\levels\ndb.dbo", objWorld
Col = NDB_NewtonCreateTreeCollision( objWorld )
Room = NDB_NewtonCreateBody( Col )
NDB_BodySetDBProData Room, objWorld
NDB_NewtonBodySetDestructorCallback Room
NDB_NewtonReleaseCollision Col


and here'is my function for make a box

function ENT_makeBox(sizex,sizey,sizez,x,y,z,anglex,angley,anglez)
i = ENT_crea()
obj = ENT_getObjID(i)
make object box obj,sizex,sizey,sizez
position object obj, x,y,z
rotate object obj, anglex,angley,anglez
collIndex = NDB_NewtonCreateBox( sizex,sizey,sizez )
Body = NDB_NewtonCreateBody( collIndex )
arrEntita(i).bodyID = Body;
NDB_BuildMatrix object angle x(obj), object angle y(obj), object angle z(obj) , object position x(obj) , object position y(obj)-size, object position z(obj)
NDB_NewtonBodySetMatrix Body

mass# = 50
NDB_CalculateMIBoxSolid mass#, size, size, size
NDB_NewtonBodySetMassMatrix Body, mass#
NDB_NewtonReleaseCollision collIndex
NDB_BodySetDBProData body, obj
NDB_NewtonBodySetDestructorCallback Body
NDB_BodySetGravity Body, 1
endfunction i


Sorry my bad english
Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 7th Jan 2011 09:27
After converting a project from Dark Physics to Newton 1.53 i have noticed some things with Newton that are important.

Object sizes.
Do not use upscaled object sizes. Newton expects one DBPro unit is one meter. So a 1x1x1 box is a cubic meter. For example if you want to simulate a pool/billiard ball this should be size: 0.057 (57 millimeters). This is very important and crucial for simulation to work as expected. Do not use a size of 57 and scale up the gravity instead.

Keep mass in a limited range for all simulated objects.
I think the help file states one should keep the mass range within a 200 range for all simulated bodies. I have experienced that the engine has very hard times calculating piled up bodies if large mass bodies are involved, resulting in extremely slow simulation times.

Regards
Duke
Sweet Vengeance
17
Years of Service
User Offline
Joined: 29th Jun 2009
Location:
Posted: 31st Jan 2011 13:00
Thanks for the tips

Now i'm having another problem.. does anyone know how to make a decent player control system with Newton? :S
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 31st Jan 2011 19:05
I'm also working on something in Newton. I didn't think about the scale factor. Does anyone know what scale factor Anim8or uses? It has grids, I'm not sure if they relate to DBPro sizes.

tiresius
23
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 31st Jan 2011 22:32
Quote: "when they hit the level they just decelerate and after some frames they gets through"

Do you set the world size? That is important in Newton 1.53.

Quote: "Now i'm having another problem.. does anyone know how to make a decent player control system with Newton? :S "

Player controller is not easily done in Newton. If that is what you are after there are a few posts showing people's progress, but it is not ideal.


A 3D marble platformer using Newton physics.

Login to post a reply

Server time is: 2026-07-19 01:27:02
Your offset time is: 2026-07-19 01:27:02