// Project: demoproblem
// Created: 19-04-14
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle("demoproblem")
SetWindowSize(1024, 768, 0)
SetWindowAllowResize(1) // allow the user to resize the window
// set display properties
SetVirtualResolution(1024, 768) // doesn't have to match the window
SetOrientationAllowed(1, 1, 1, 1) // allow both portrait and landscape on mobile devices
SetSyncRate(30, 0) // 30fps instead of 60 to save battery
SetScissor(0, 0, 0, 0) // use the maximum available screen space, no black borders
UseNewDefaultFonts(1)
global cx=0
global cy=0
global cz=0
global gravity_Y#=-8.87
global camdist=50
global ground=1
global alpha=255
init(2)
do
Step3DPhysicsWorld()
setobjectposition(ground,cx,cy,cz)
setcameraposition(1,cx,cy+camdist,cz-camdist)
setcameralookat(1,cx,cy,cz,0)
Print(ScreenFPS())
Sync()
loop
Function init(scalesize)
create3dphysicsworld(scalesize)
set3dphysicsgravity(0,gravity_y#,0)
create_my_object(ground,0,0,0,2,5.0,5.0,5.0,15.0,1.0,15.0,0,255,255,0,255,0.7,0.7,0.01,1,0)
create_my_object(10,0,20,0,1,5.0,5.0,5.0,1.0,1.0,1.0,5,255,0,0,255,0.7,0.7,0.01,2,0)
create_my_object(11,10,20,0,1,5.0,5.0,5.0,1.0,1.0,1.0,5,0,0,255,255,1.0,0.7,0.01,2,3.5)
endfunction
function create_my_object(id,x#,y#,z#,shape,sx#,sy#,sz#,scx#,scy#,scz#,rad#,r,g,b,alpha,rest#,fric#,damp#,pb,mass)
select shape
case 2
createobjectbox(id,sx#,sy#,sz#)
endcase
case 1
createobjectsphere(id,rad#,32,32)
endcase
endselect
setobjectscalepermanent(id,scx#,scy#,scz#)
setobjectposition(id,x#,y#,z#)
setobjectcolor(id,r,g,b,alpha)
createobjectphysics(id,pb,shape)
SetObject3DPhysicsFriction(id,fric#)
//SetObject3DPhysicsrestitution(id,rest#)
//SetObject3DPhysicsdamping(id,damp#,damp#)
SetObject3DPhysicsrestitution(id,1.0)
SetObject3DPhysicsdamping(id,0,0)
if pb>1
SetObject3DPhysicsCanSleep(id,0)
endif
if mass>0
/// only set mass if value passed was >0 else agk will set it
SetObject3DPhysicsmass(id,mass)
endif
endfunction
function createobjectphysics(myobj,myphybody,myphyshape)
select myphybody
case 1
Create3DPhysicsStaticBody(myobj)
endcase
case 2
Create3DPhysicsDynamicBody(myobj)
endcase
endselect
select myphyshape
case 1
SetObjectShapesphere(myobj)
endcase
case 2
SetObjectShapebox(myobj)
endcase
case 3
SetObjectShapeCylinder(myobj,90)
endcase
case 7
setobjectshapeconvexhull(myobj)
endcase
case 8
SetObjectShapeStaticPolygon(myobj)
endcase
endselect
endfunction
did this demo only to realize it was error in my logic,but here is h demo anyhow,yeh everything is fine, I wasnt setting the mass of the terrain to reflect its scaling!
in the demo the red ball doesnt get a user mass whilst the blue one does!!
So everything is fine, this might come in handy for anyone,better than waste!
Hail to the king, baby!