Game Development Community

Newton Physics Engine integrated (Part 1)

by William Bryan · in Torque Game Engine · 03/19/2004 (3:39 pm) · 54 replies

Ive integraded the 1.01 version of the free Newton physics engine with Torque (www.physicsengine.com)

Ill try to get a demo of something available, but below is the list of calls available for those of you who are physics junkies.

World interface
NewtonCreate Create an instance of the Newton world.
NewtonDestroy Destroy an instance of the Newton world.
NewtonUpdate Advance the simulation by an amount of time.
NewtonSetMinimumFrameRate Set the minimum frame rate at witch the simulation can run.
NewtonDestroyAllBodies Remove all bodies and joints from the newton world.
NewtonSetWorldSize Set the size of the Newton world.
NewtonSetBodyLeaveWorldEvent Set the event callback function to be called in the event a body escaping the limits of the world during simulation time.
NewtonWorldFreezeBody Remove the body from the active simulation list.
NewtonWorldUnfreezeBody Add the body to the active simulation list.
GroupID interface
NewtonMaterialGetDefaultGroupID Get the value of the default MaterialGroupID.
NewtonMaterialCreateGroupID Create a new MaterialGroupID.
NewtonMaterialDestroyAllGroupID Remove all groups ID from the Newton world.
Material setup interface
NewtonMaterialSetDefaultCollidable Set the material defined by the interaction between two physics groups to be collidable or non-collidable by default.
NewtonMaterialSetDefaultFriction Set the default coefficients of friction for the material defined by the interaction between two physics groups.
NewtonMaterialSetDefaultElasticity Set the default coefficents of restitution (elasticity) for the material defined by the interaction between two physics groups.
NewtonMaterialSetDefaultSoftness Set the default softness coefficents for the material defined by the interaction between two physics groups.
NewtonMaterialSetCollisionCallback Set userData and the functions event handles for the material defined by the interaction between two physics groups.
Contact behaviour control interface
NewtonMaterialDisableContact Disable processing for the contact.
NewtonMaterialGetContactUserData Get the userData set by the application when it created this material pair.
NewtonMaterialGetContactNormalSpeed Calculate the speed of this contact along the normal vector of the contact.
Page «Previous 1 2 3 Last »
#1
03/19/2004 (3:40 pm)
NewtonMaterialGetContactTangentSpeed Calculate the speed of this contact along the tangent vector of the contact.
NewtonMaterialGetContactPositionAndNormal Get the contact position and normal in global space.
NewtonMaterialGetContactTangentDirections Get the contact tangent vector to the contact point.
NewtonMaterialSetContactSoftness Override the default softness value for the contact.
NewtonMaterialSetContactElasticity override the default elasticity (coeficient of restitution) value for the contact.
NewtonMaterialSetContactFrictionState Enable or disable friction calculation for this contact.
NewtonMaterialSetContactStaticFrictionCoef Override the default value of the static coefficient of friction for this contact.
NewtonMaterialSetContactKineticFrictionCoef Override the default value of the kinetic coefficient of friction for this contact.
NewtonMaterialSetContactTangentAcceleration Force the contact point to have a non zero acceleration along the surface plane.
NewtonMaterialContactRotateTangentDirections Rotate the tangent direction of the contacts until primary direction is aligned with the alignVector.
Convex collision primitives interface
NewtonCreateSphere Create a sphere primitive for collision.
NewtonCreateBox Create a box primitive for collision.
NewtonCreateCompoundCollision Create a container to hold an array of convex collision primitives.
Complex collision primitives interface
NewtonCreateUserMeshCollision Create a complex collision geometry to be controlled by the application.
NewtonCreateTreeCollision Create an empty complex collision geometry tree.
NewtonTreeCollisionBeginBuild Prepare a TreeCollision to begin to accept the polygons that comprise the collision mesh.
NewtonTreeCollisionAddFace Add an individual polygon to a TreeCollision .
NewtonTreeCollisionEndBuild Finalize the construction of the polygonal mesh.
NewtonTreeCollisionSerialize Serialize a TreeCollision .
NewtonCreateTreeCollisionFromSerialization Create a tree collsion and load the polygon mesh via a serialization function.
NewtonTreeCollisionGetFaceAtribute Get the user defined collision attributes stored with each face of the collision mesh.
NewtonTreeCollisionSetFaceAtribute Change the user defined collision attribute stored with faces of the collision mesh.
Collision miscelanios interface
NewtonReleaseCollision Release a reference from this collision object.
NewtonCollisionCalculateAABB Calculate an axis-aligned bounding box for this collision, the box is calculated relative to offsetMatrix .
Transform utility functions
NewtonGetEulerAngle Get the three Euler angles from a 4x4 rotation matrix arranged in row-major order.
NewtonSetEulerAngle Build a rotation matrix from the Euler angles in radians.
Rigid body interface
NewtonCreateBody Create a rigid body.
NewtonDestroyBody Destroy a rigid body.
NewtonBodySetUserData Store a user defined data value with the body.
NewtonBodyGetUserData Retrieve a user defined data value stored with the body.
NewtonBodySetTransformCallback Assign a transformation event function to the body.
NewtonBodySetForceAndTorqueCallback Assign an event function for applying external force and torque to a rigid body.
NewtonBodySetDestructorCallback Assign an event function to be called when this body is about to be destroyed.
#2
03/19/2004 (3:40 pm)
NewtonBodySetMassMatrix Set the mass matrix of a rigid body.
NewtonBodyGetMassMatrix Get the mass matrix of a rigid body.
NewtonBodyGetInvMass Get the inverse mass matrix of a rigid body.
NewtonBodySetMatrix Set the transformation matrix of a rigid body.
NewtonBodySetMatrixRecursive Apply hierachical transformation to a body.
NewtonBodyGetMatrix Get the transformation matrix of a rigid body.
NewtonBodySetForce Set the net force applied to a rigid body.
NewtonBodyAddForce Add the net force applied to a rigid body.
NewtonBodyGetForce Get the net force applied to a rigid body.
NewtonBodySetTorque Set the net torque applied to a rigid body.
NewtonBodyAddTorque Add the net torque applied to a rigid body.
NewtonBodyGetTorque Get the net torque applied to a rigid body.
NewtonBodyAddBuoyancyForce Add buoyancy force and torque for bodies immersed in a fluid.
NewtonBodySetCollision Assign a collision primitive to the body.
NewtonBodyGetCollision Get the collision primitive of a body.
NewtonBodySetMaterialGroupID Assign a material group id to the body.
NewtonBodyGetMaterialGroupID Get the material group id of the body.
NewtonBodySetAutoFreeze Set the auto-activation mode for this body.
NewtonBodyGetAutoFreeze Get the auto-activation state of the body.
NewtonBodySetFreezeTreshold Set the minimum values for velocity and acceleration of a body that will be considered at rest.
NewtonBodyGetFreezeTreshold Get the minimum values for velocity and acceleration of a body the will be considered at rest.
NewtonBodyGetAABB Get the world axis aligned bounding box (AABB) of the body.
NewtonBodySetVelocity Set the global linear velocity of the body.
NewtonBodyGetVelocity Get the global linear velocity of the body.
NewtonBodySetOmega Set the global angular velocity of the body.
NewtonBodyGetOmega Get the global angular velocity of the body.
NewtonBodySetLinearDamping Apply the linear viscous damping coefficient to the body.
NewtonBodyGetLinearDamping Get the linear viscous damping of the body.
NewtonBodySetAngularDamping Apply the angular viscous damping coefficient to the body.
NewtonBodyGetAngularDamping Get the linear viscous damping of the body.
NewtonBodyRayIntersect Shoot a ray from p0 to p1 and return the parametric intersection.
NewtonAddBodyImpulse Add an impulse to a specific point on a body.
#3
03/19/2004 (5:31 pm)
I downloaded and played a demo. Newton has good physics, but how much of it have you gotten working with Torque(ragdoll, joints, or just rolling boxes)?
#4
03/19/2004 (5:43 pm)
None yet, just the initial integration and compile, now i have to see about making the calls, either through torque or via python which i have in as well
#5
03/20/2004 (1:40 am)
I thought Newton Physics was for the Acknex 5/6 engine (aka 3D GameStudio)?
#6
03/20/2004 (6:55 am)
No, its actually a stand alone produce, if you download the SDK version, you can compile the example DirextX applications without any engine. To incorporate it into an engine is just a .dll addon and a .h defs.

Someone ported it for 3DGS first because with 3DGS you get 1 physics engine at the commercial level (199.00) and unlimited engines at the 800.00 level professional edition, and newton is free.
#7
03/20/2004 (7:07 am)
Newton looks interesting but integrating it with Torque may prove to be a pain. I tried to go through and use ODE once. It was a very daunting task that I just gave up on. Making it work with Torque is easy, but replacing Torques completely is a lot of work :(
#8
03/20/2004 (4:29 pm)
Ah, Thanks William. I get it now :)
#9
03/20/2004 (5:31 pm)
Im thinking of using Python calls for the physics objects since i have python integrated too, though i know Torque has a C call, im having trouble getting it to play nice with others.
#10
04/29/2004 (8:01 pm)
Id be interested in seeing what you've done so far William, Im trying out a few diff physics engines at the moment.

Newton isnt cross platform is it? (*nix)
And whats the liscense like? It wasnt very clear to me...
#11
05/23/2004 (8:21 am)
Ny more work done in this area??
#12
06/03/2004 (9:51 pm)
I just added this to a build of mine, got the world up and running and need to start with the objects.
#13
06/05/2004 (12:42 am)
Ok, I think we need to wait at least rev. 1.3 because until now there is a big problem with the client-server approach of torque, if this problem can be solved, integrate Newton into Torque isn't a big deal, I've already replaced the item class and the terrain removing all the collision system in torque and it works well but also in the single player mode, the server side item doesn't do the same thing as the client side item !!! Julio is working on this problem and with 1.3 he should have fixed it and found a clever way to handle client-server connection....
#14
06/06/2004 (5:21 pm)
Davide, thats extremely good to know, I got myself stuck quite awhile ago, I dont have enough experiance to do much at the moment.
Looking forward to hearing more about it.

btw, how did you go about replacing torques coll system with newtons? I found it a right bitch to work out/around.
#15
06/06/2004 (10:18 pm)
Quote:btw, how did you go about replacing torques coll system with newtons? I found it a right bitch to work out/around.

it was very simple, at least untill now :), for example, the terrain, I've just removed all the collision code and replaced the rayCast function with the newtonRayCast.
Anyways it's soon and there are those client-server problems, but newton seems very stable.... we'll see.
#16
06/07/2004 (9:07 am)
Seems impressive, I wish you luck !
#17
08/08/2004 (2:04 pm)
Hello

Do you plan to share your code? I am very interested in implementing ragdolls and i think NGD should be very usefull for not only this.

Thank you and best regards
#18
01/12/2005 (4:15 pm)
Hey, is there any update to this? We plan to use Newton, and if i could avoid it, i'd prefer not to start off fumbling in the dark :)
#19
01/12/2005 (4:31 pm)
I'd also rather use Newton over ODE (it's more stable and has game specific features). If no one tries by the time i get to this i was planning on using the ODEItem resource as a guide for integration of 3rd-party physics into Torque.
#20
01/12/2005 (10:43 pm)
Isn't Newton single platform, though?
Page «Previous 1 2 3 Last »