Have you guys looked at the six demos that come with Walaber's wrappers? They have source code and everything. Several of the demos give you direct control over the units involved.
I did find one glitch in version 123d, the html help file uses the htm extension while the keywords file uses html.
David, setting up gravity is snap. Assuming one unit is equal to one meter, this is all you need.
NDB_SetVector 0.0, -9.8, 0.0
NDB_SetStandardGravity
The key is the vector. By matching the tilt of the board to the force of 'X' or 'Z' gravity, you can pull a ball in any direction. To simulate a slope to the right, increase the size of the X vector. Between the pull of gravity and the internal inertia of the ball, you should be able to simulate the effect quite nicely.
Callum, did you download Walaber's wrapper and follow the instructions in the readme file? His wrapper is the interface between the language and the library.
Hawkeye, most of the collision/physics handling stuff is done for you. Now, if you want to handle your own collisions inside Newton, that does require a little more work. Basically, you have to create material groups, assign those groups to bodies, and then check for collisions with those bodies.
This isn't a proper demo as much as a very basic set of commands that I'm using in my Ice Snake contest entry...
rem Statements that are used to set up some very basic materials
rem with everything left to their default values.
materialID = NDB_NewtonMaterialCreateGroupID()
snakeID = NDB_NewtonMaterialCreateGroupID()
NDB_NewtonMaterialSetDefaultCollidable materialID, snakeID, 1
NDB_NewtonMaterialSetCollisionCallback materialID, snakeID
'-----------------
rem Assign a material ID to the berries
rem food(a) is an array of integers equal to a rigid body index
rem for each individual berry.
NDB_NewtonBodySetMaterialGroupID food(a), materialID
'-----------------
rem Assign a material ID to the snake head
rem Body is the rigid body index for the snake's head
NDB_NewtonBodySetMaterialGroupID Body, snakeID
'-----------------
rem Walk through the food array. If a berry has been eaten, it
rem is set to zero and ignored in the future.
for i=1 to 25
if food(i) > 0
if NDB_GetCollision(food(i), head_body) > 0
rem A Food/head collision has occured, deal with it...
hide object NDB_GetDBPro(food(i))
food(i)=0
eaten = eaten + 1
rem It is important to run the collision check AFTER the update
rem command. That gives the physics engine a chance to refresh
rem all the object locations and apply any required forces.
In case I missed something in one of the existing demos, that would be a good next demo for Walaber to add. Of course, I'll make the Ice Snake source code available after the contest. [Perhaps before hand as well, but it won't be as pretty as what the judges would get.]
--
TAZ
"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1