right, tnx for that, I chose the latter option, but there seems to be a gap between the object controller and the object for the floor:
// Project: testtube
// Created: 2015-11-02
// set window properties
SetWindowTitle( "testtube" )
`SetWindowSize(320,240,1)
SetWindowSize(640,480,1)
// set display properties
`SetDisplayAspect( 320.0 / 240.0 )
SetDisplayAspect( 640.0 / 480.0 )
SetOrientationAllowed( 1, 1, 1, 1 )
`SetSyncRate(60,0)
SetScissor(0,0,0,0)
Create3DPhysicsWorld(40)
Set3DPhysicsGravity(0,-5,0)
#constant KEY_Q = 81
global obj=0
global myfloor=0
global CameraDistance#=40
init()
platformer()
end
function init()
obj=createobjectbox(5 ,10, 16)
setobjectcolor(obj,255,0,0,255)
SetObjectPosition(obj,0,40,0)
` createobjectphysics(obj,2,2)
myfloor=createobjectbox(20,20,20)
setobjectposition(myfloor,0,0,0)
createobjectphysics(myfloor,2,1)
characterOffsetVec = CreateVector3( 0.0, 0.0, 0.0 )
//This vector indicates the axis your model faces forward.
//For example if your model faces down the - Z axis use this vector.
objectOrientationVec = CreateVector3( 0.0, 0.0, -1.0 )
//The crouchScale parameter is 0.0 to 1.0, for examle 0.75 is 75% of the models standing height.
`Create3DPhysicsCharacterController(obj, 1, characterOffsetVec, objectOrientationVec, 0.75 )
Create3DPhysicsCharacterController(obj, 2, characterOffsetVec, objectOrientationVec, 0.75 )
DeleteVector3( characterOffsetVec )
DeleteVector3( objectOrientationVec )
endfunction
function platformer()
repeat
xpos#=getobjectx(obj)
ypos#=getobjecty(obj)
zpos#=getobjectz(obj)
if getrawkeypressed(KEY_Q)
quittest=1
endif
setcameraposition(1,xpos#,ypos#,zpos#+CameraDistance#)
setcameralookat(1,xpos#,ypos#,zpos#,0)
Step3DPhysicsWorld()
sync()
until quittest=1
quittest=0
endfunction
function createobjectphysics(myobj,myphyshape,myphybody)
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
endselect
endfunction
Hail to the king, baby!