Thanks Fubarpk for that nice explanation
Here is a quick example - made with cubes though
// Project: physicstest
// Created: 2019-01-29
// show all errors
SetErrorMode(2)
#constant screenwidth=1024
#constant screenheight=768
#constant fullscreen=1
#constant screenrate=0
// set window properties
SetWindowTitle( "physicstest" )
SetWindowSize( screenwidth, screenheight, fullscreen )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( screenwidth, screenheight ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( screenrate, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
Create3DPhysicsWorld()
fallingtreephysics()
do
Step3DPhysicsWorld()
Print( ScreenFPS() )
Sync()
loop
function fallingtreephysics()
grd = CreateObjectPlane(10,10)
SetObjectRotation(grd,90,0,0)
tree = CreateObjectBox(1,5,1)
stump = CreateObjectBox(1,1,1)
//SetObjectRotation( tree, 30, 0, 0 )
// SetObjectImage( tree, tree_img, 0 )
// SetObjectImage( stump, tree_img, 0 )
SetObjectAlphaMask( tree, 1 )
SetObjectCullMode( tree, 0 )
SetObjectPosition( tree, 0, 5, 0 )
SetObjectCollisionMode( stump, 0 )
Create3DPhysicsDynamicBody( tree )
Create3DPhysicsStaticBody( grd )
//Create3DPhysicsStaticBody( stump )
//SetObject3DPhysicsMass( stump, 1000 )
SetObjectShapeStaticPolygon( grd )
SetObject3DPhysicsMass( grd, 999999 )
SetObject3DPhysicsRestitution( grd, 0 )
SetObject3DPhysicsRestitution( tree, 0 )
SetObject3DPhysicsMass( tree, 5000 )
SetObjectShapeCylinder( tree, 1, 3.8, .5 )
//SetObjectShapeBox(tree, .1,2,.1)
endfunction
Seems like this does exactly what you want to do.
But then its not using your model