Thanks Duke E,never really noticed a problem with the phy set rigid body mass ,allways seems to do exactly what it says until the amounts get realy high, but i`ll give your method a try and see if it improves things."Gocarty" was exactly what i was aiming for so i guess i got it fairly close.
Latest try at this using a lot more joints and it now has suspension on it.
`%ProjectTitle%
`======================
`P.Parkinson
`======================
`Main Source File
sync on
sync rate 60
autocam off
color backdrop 0, 0
set text font "Arial"
set text size 12
set text transparent
position camera 10,40,-50
point camera 0,0,0
phy start
`make material
global hardrubber as integer=1
phy make material hardrubber,"hardrubber"
phy set material dynamic friction hardrubber,0.5
phy set material static friction hardrubber,0.5
phy set material restitution hardrubber,1.0
phy build material hardrubber
`make joint marker mesh
joint_marker()
make_texture1(1)
make_floor(5000)
global j_num as integer=1
global rear_spring as integer=10000000
global front_spring as integer=10000000
global steering_return_spring as integer=10000
global wheel_base as float=30.0
global steering_torque as integer=1000
global drive as float=300.0
global f_r_t_wishbone as integer=1
global f_r_t_wishbone_posx as float=5.0
global f_r_t_wishbone_posy as float=2.0
global f_r_t_wishbone_posz as float:f_r_t_wishbone_posz=wheel_base/2.0
make_f_r_t_wishbone(0,20,0)
global f_r_b_wishbone as integer=2
global f_r_b_wishbone_posx as float=5.0
global f_r_b_wishbone_posy as float=-2.0
global f_r_b_wishbone_posz as float:f_r_b_wishbone_posz=wheel_base/2.0
make_f_r_b_wishbone(0,20,0)
global f_l_t_wishbone as integer=3
global f_l_t_wishbone_posx as float=-5.0
global f_l_t_wishbone_posy as float=2.0
global f_l_t_wishbone_posz as float:f_l_t_wishbone_posz=wheel_base/2.0
make_f_l_t_wishbone(0,20,0)
global f_l_b_wishbone as integer=4
global f_l_b_wishbone_posx as float=-5.0
global f_l_b_wishbone_posy as float=-2.0
global f_l_b_wishbone_posz as float:f_l_b_wishbone_posz=wheel_base/2.0
make_f_l_b_wishbone(0,20,0)
global chasis as integer=5
global chasis_posx as float=0.0
global chasis_posy as float=0.0
global chasis_posz as float=0.0
make_chasis(0,20,0)
global b_r_t_wishbone as integer=6
global b_r_t_wishbone_posx as float=8.0
global b_r_t_wishbone_posy as float=2.0
global b_r_t_wishbone_posz as float:b_r_t_wishbone_posz=(wheel_base/2.0)*-1
make_b_r_t_wishbone(0,20,0)
global b_r_b_wishbone as integer=7
global b_r_b_wishbone_posx as float=8.0
global b_r_b_wishbone_posy as float=-2.0
global b_r_b_wishbone_posz as float:b_r_b_wishbone_posz=(wheel_base/2.0)*-1
make_b_r_b_wishbone(0,20,0)
global b_l_t_wishbone as integer=8
global b_l_t_wishbone_posx as float=-8.0
global b_l_t_wishbone_posy as float=2.0
global b_l_t_wishbone_posz as float:b_l_t_wishbone_posz=(wheel_base/2.0)*-1
make_b_l_t_wishbone(0,20,0)
global b_l_b_wishbone as integer=9
global b_l_b_wishbone_posx as float=-8.0
global b_l_b_wishbone_posy as float=-2.0
global b_l_b_wishbone_posz as float:b_l_b_wishbone_posz=(wheel_base/2.0)*-1
make_b_l_b_wishbone(0,20,0)
global b_r_hub as integer=10
global b_r_hub_posx as float=14.0
global b_r_hub_posy as float=0.0
global b_r_hub_posz as float:b_r_hub_posz=(wheel_base/2.0)*-1
make_b_r_hub(0,20,0)
global b_l_hub as integer=11
global b_l_hub_posx as float=-14.0
global b_l_hub_posy as float=0.0
global b_l_hub_posz as float:b_l_hub_posz=(wheel_base/2.0)*-1
make_b_l_hub(0,20,0)
global f_r_upright as integer=12
global f_r_upright_posx as float=8.0
global f_r_upright_posy as float=0.0
global f_r_upright_posz as float:f_r_upright_posz=wheel_base/2.0
make_f_r_upright(0,20,0)
global f_l_upright as integer=13
global f_l_upright_posx as float=-8.0
global f_l_upright_posy as float=0.0
global f_l_upright_posz as float:f_l_upright_posz=wheel_base/2.0
make_f_l_upright(0,20,0)
global f_r_wheel as integer=14
global f_r_wheel_posx as float=17.0
global f_r_wheel_posy as float=0.0
global f_r_wheel_posz as float:f_r_wheel_posz=wheel_base/2.0
make_f_r_wheel(0,20,0)
global f_l_wheel as integer=15
global f_l_wheel_posx as float=-17.0
global f_l_wheel_posy as float=0.0
global f_l_wheel_posz as float:f_l_wheel_posz=wheel_base/2.0
make_f_l_wheel(0,20,0)
global b_r_wheel as integer=16
global b_r_wheel_posx as float=20.0
global b_r_wheel_posy as float=0.0
global b_r_wheel_posz as float:b_r_wheel_posz=(wheel_base/2.0)*-1
make_b_r_wheel(0,20,0)
global b_l_wheel as integer=17
global b_l_wheel_posx as float=-20.0
global b_l_wheel_posy as float=0.0
global b_l_wheel_posz as float:b_l_wheel_posz=(wheel_base/2.0)*-1
make_b_l_wheel(0,20,0)
global f_r_hub as integer=18
global f_r_hub_posx as float=11.5
global f_r_hub_posy as float=0.0
global f_r_hub_posz as float:f_r_hub_posz=wheel_base/2.0
make_f_r_hub(0,20,0)
global f_l_hub as integer=19
global f_l_hub_posx as float=-11.5
global f_l_hub_posy as float=0.0
global f_l_hub_posz as float:f_l_hub_posz=wheel_base/2.0
make_f_l_hub(0,20,0)
make_physx_objects(f_r_t_wishbone,f_l_hub)
make_joints()
do
if spacekey()
phy add rigid body local torque b_r_wheel,0,drive*-1,0,1
phy add rigid body local torque b_l_wheel,0,drive*-1,0,1
phy add rigid body local torque f_r_wheel,0,drive*-1,0,1
phy add rigid body local torque f_l_wheel,0,drive*-1,0,1
``phy add rigid body local force chasis,0,0,drive,1
endif
if inkey$()="r"
phy add rigid body local torque b_r_wheel,0,drive,0,1
phy add rigid body local torque b_l_wheel,0,drive,0,1
phy add rigid body local torque f_r_wheel,0,drive,0,1
phy add rigid body local torque f_l_wheel,0,drive,0,1
``phy add rigid body local force chasis,0,0,drive*-1,1
endif
if leftkey()
phy add rigid body local torque f_l_hub,0,steering_torque*-1,0,1
phy add rigid body local torque f_r_hub,0,steering_torque*-1,0,1
endif
if rightkey()
phy add rigid body local torque f_l_hub,0,steering_torque,0,1
phy add rigid body local torque f_r_hub,0,steering_torque,0,1
endif
set camera to follow object position x(chasis),object position y(chasis),object position z(chasis),0,80,80,50,0
``mousecontrol(0.5)
phy update
sync
loop
function MouseControl(Speed as float)
xrotate camera camera angle x()+mousemovey()
yrotate camera camera angle y()+mousemovex()
if mouseclick()=1 then move camera Speed
if mouseclick()=2 then move camera (0-Speed)
r=mousemovex()
r=mousemovey()
endfunction
function joint_marker()
make object sphere 1,1
make mesh from object 1,1
delete object 1
endfunction
function make_f_r_t_wishbone(posx#,posy#,posz#)
make object box f_r_t_wishbone,1,1,3
make object box 1000,7,1,1
make mesh from object 2,1000
delete object 1000
add limb f_r_t_wishbone,1,2
offset limb f_r_t_wishbone,1,0,0,2.0
add limb f_r_t_wishbone,2,2
offset limb f_r_t_wishbone,2,0,0,-2.0
add limb f_r_t_wishbone,3,1
offset limb f_r_t_wishbone,3,-3,0,1.5
add limb f_r_t_wishbone,4,1
offset limb f_r_t_wishbone,4,3,0,1.5
add limb f_r_t_wishbone,5,1
offset limb f_r_t_wishbone,5,-3,0,-1.5
add limb f_r_t_wishbone,6,1
offset limb f_r_t_wishbone,6,3,0,-1.5
color object f_r_t_wishbone,rgb(255,0,0)
color limb f_r_t_wishbone,3,rgb(255,255,255)
color limb f_r_t_wishbone,4,rgb(255,255,255)
color limb f_r_t_wishbone,5,rgb(255,255,255)
color limb f_r_t_wishbone,6,rgb(255,255,255)
position object f_r_t_wishbone,f_r_t_wishbone_posx+posx#,f_r_t_wishbone_posy+posy#,f_r_t_wishbone_posz+posz#
delete mesh 2
endfunction
function make_f_r_b_wishbone(posx#,posy#,posz#)
make object box f_r_b_wishbone,1,1,3
make object box 1000,7,1,1
make mesh from object 2,1000
delete object 1000
add limb f_r_b_wishbone,1,2
offset limb f_r_b_wishbone,1,0,0,2.0
add limb f_r_b_wishbone,2,2
offset limb f_r_b_wishbone,2,0,0,-2.0
add limb f_r_b_wishbone,3,1
offset limb f_r_b_wishbone,3,-3,0,1.5
add limb f_r_b_wishbone,4,1
offset limb f_r_b_wishbone,4,3,0,1.5
add limb f_r_b_wishbone,5,1
offset limb f_r_b_wishbone,5,-3,0,-1.5
add limb f_r_b_wishbone,6,1
offset limb f_r_b_wishbone,6,3,0,-1.5
color object f_r_b_wishbone,rgb(255,0,0)
color limb f_r_b_wishbone,3,rgb(255,255,255)
color limb f_r_b_wishbone,4,rgb(255,255,255)
color limb f_r_b_wishbone,5,rgb(255,255,255)
color limb f_r_b_wishbone,6,rgb(255,255,255)
position object f_r_b_wishbone,f_r_b_wishbone_posx+posx#,f_r_b_wishbone_posy+posy#,f_r_b_wishbone_posz+posz#
delete mesh 2
endfunction
function make_f_l_t_wishbone(posx#,posy#,posz#)
make object box f_l_t_wishbone,1,1,3
make object box 1000,7,1,1
make mesh from object 2,1000
delete object 1000
add limb f_l_t_wishbone,1,2
offset limb f_l_t_wishbone,1,0,0,2.0
add limb f_l_t_wishbone,2,2
offset limb f_l_t_wishbone,2,0,0,-2.0
add limb f_l_t_wishbone,3,1
offset limb f_l_t_wishbone,3,-3,0,1.5
add limb f_l_t_wishbone,4,1
offset limb f_l_t_wishbone,4,3,0,1.5
add limb f_l_t_wishbone,5,1
offset limb f_l_t_wishbone,5,-3,0,-1.5
add limb f_l_t_wishbone,6,1
offset limb f_l_t_wishbone,6,3,0,-1.5
color object f_l_t_wishbone,rgb(255,0,0)
color limb f_l_t_wishbone,3,rgb(255,255,255)
color limb f_l_t_wishbone,4,rgb(255,255,255)
color limb f_l_t_wishbone,5,rgb(255,255,255)
color limb f_l_t_wishbone,6,rgb(255,255,255)
position object f_l_t_wishbone,f_l_t_wishbone_posx+posx#,f_l_t_wishbone_posy+posy#,f_l_t_wishbone_posz+posz#
delete mesh 2
endfunction
function make_f_l_b_wishbone(posx#,posy#,posz#)
make object box f_l_b_wishbone,1,1,3
make object box 1000,7,1,1
make mesh from object 2,1000
delete object 1000
add limb f_l_b_wishbone,1,2
offset limb f_l_b_wishbone,1,0,0,2.0
add limb f_l_b_wishbone,2,2
offset limb f_l_b_wishbone,2,0,0,-2.0
add limb f_l_b_wishbone,3,1
offset limb f_l_b_wishbone,3,-3,0,1.5
add limb f_l_b_wishbone,4,1
offset limb f_l_b_wishbone,4,3,0,1.5
add limb f_l_b_wishbone,5,1
offset limb f_l_b_wishbone,5,-3,0,-1.5
add limb f_l_b_wishbone,6,1
offset limb f_l_b_wishbone,6,3,0,-1.5
color object f_l_b_wishbone,rgb(255,0,0)
color limb f_l_b_wishbone,3,rgb(255,255,255)
color limb f_l_b_wishbone,4,rgb(255,255,255)
color limb f_l_b_wishbone,5,rgb(255,255,255)
color limb f_l_b_wishbone,6,rgb(255,255,255)
position object f_l_b_wishbone,f_l_b_wishbone_posx+posx#,f_l_b_wishbone_posy+posy#,f_l_b_wishbone_posz+posz#
delete mesh 2
endfunction
function make_chasis(posx#,posy#,posz#)
make object box chasis,2,1,wheel_base-2
make object box 1000,6,5,2
make mesh from object 2,1000
delete object 1000
add limb chasis,1,2
offset limb chasis,1,0,0,wheel_base/2
add limb chasis,2,2
offset limb chasis,2,0,0,(wheel_base/2)*-1
color object chasis,rgb(0,0,255)
position object chasis,chasis_posx+posx#,chasis_posy+posy#,chasis_posz+posz#
delete mesh 2
endfunction
function make_b_r_t_wishbone(posx#,posy#,posz#)
make object box b_r_t_wishbone,1,1,3
make object box 1000,13,1,1
make mesh from object 2,1000
delete object 1000
add limb b_r_t_wishbone,1,2
offset limb b_r_t_wishbone,1,0,0,2.0
add limb b_r_t_wishbone,2,2
offset limb b_r_t_wishbone,2,0,0,-2.0
add limb b_r_t_wishbone,3,1
offset limb b_r_t_wishbone,3,-6,0,1.5
add limb b_r_t_wishbone,4,1
offset limb b_r_t_wishbone,4,6,0,1.5
add limb b_r_t_wishbone,5,1
offset limb b_r_t_wishbone,5,-6,0,-1.5
add limb b_r_t_wishbone,6,1
offset limb b_r_t_wishbone,6,6,0,-1.5
color object b_r_t_wishbone,rgb(255,0,0)
color limb b_r_t_wishbone,3,rgb(255,255,255)
color limb b_r_t_wishbone,4,rgb(255,255,255)
color limb b_r_t_wishbone,5,rgb(255,255,255)
color limb b_r_t_wishbone,6,rgb(255,255,255)
position object b_r_t_wishbone,b_r_t_wishbone_posx+posx#,b_r_t_wishbone_posy+posy#,b_r_t_wishbone_posz+posz#
delete mesh 2
endfunction
function make_b_r_b_wishbone(posx#,posy#,posz#)
make object box b_r_b_wishbone,1,1,3
make object box 1000,13,1,1
make mesh from object 2,1000
delete object 1000
add limb b_r_b_wishbone,1,2
offset limb b_r_b_wishbone,1,0,0,2.0
add limb b_r_b_wishbone,2,2
offset limb b_r_b_wishbone,2,0,0,-2.0
add limb b_r_b_wishbone,3,1
offset limb b_r_b_wishbone,3,-6,0,1.5
add limb b_r_b_wishbone,4,1
offset limb b_r_b_wishbone,4,6,0,1.5
add limb b_r_b_wishbone,5,1
offset limb b_r_b_wishbone,5,-6,0,-1.5
add limb b_r_b_wishbone,6,1
offset limb b_r_b_wishbone,6,6,0,-1.5
color object b_r_b_wishbone,rgb(255,0,0)
color limb b_r_b_wishbone,3,rgb(255,255,255)
color limb b_r_b_wishbone,4,rgb(255,255,255)
color limb b_r_b_wishbone,5,rgb(255,255,255)
color limb b_r_b_wishbone,6,rgb(255,255,255)
position object b_r_b_wishbone,b_r_b_wishbone_posx+posx#,b_r_b_wishbone_posy+posy#,b_r_b_wishbone_posz+posz#
delete mesh 2
endfunction
function make_b_l_t_wishbone(posx#,posy#,posz#)
make object box b_l_t_wishbone,1,1,3
make object box 1000,13,1,1
make mesh from object 2,1000
delete object 1000
add limb b_l_t_wishbone,1,2
offset limb b_l_t_wishbone,1,0,0,2.0
add limb b_l_t_wishbone,2,2
offset limb b_l_t_wishbone,2,0,0,-2.0
add limb b_l_t_wishbone,3,1
offset limb b_l_t_wishbone,3,-6,0,1.5
add limb b_l_t_wishbone,4,1
offset limb b_l_t_wishbone,4,6,0,1.5
add limb b_l_t_wishbone,5,1
offset limb b_l_t_wishbone,5,-6,0,-1.5
add limb b_l_t_wishbone,6,1
offset limb b_l_t_wishbone,6,6,0,-1.5
color object b_l_t_wishbone,rgb(255,0,0)
color limb b_l_t_wishbone,3,rgb(255,255,255)
color limb b_l_t_wishbone,4,rgb(255,255,255)
color limb b_l_t_wishbone,5,rgb(255,255,255)
color limb b_l_t_wishbone,6,rgb(255,255,255)
position object b_l_t_wishbone,b_l_t_wishbone_posx+posx#,b_l_t_wishbone_posy+posy#,b_l_t_wishbone_posz+posz#
delete mesh 2
endfunction
function make_b_l_b_wishbone(posx#,posy#,posz#)
make object box b_l_b_wishbone,1,1,3
make object box 1000,13,1,1
make mesh from object 2,1000
delete object 1000
add limb b_l_b_wishbone,1,2
offset limb b_l_b_wishbone,1,0,0,2.0
add limb b_l_b_wishbone,2,2
offset limb b_l_b_wishbone,2,0,0,-2.0
add limb b_l_b_wishbone,3,1
offset limb b_l_b_wishbone,3,-6,0,1.5
add limb b_l_b_wishbone,4,1
offset limb b_l_b_wishbone,4,6,0,1.5
add limb b_l_b_wishbone,5,1
offset limb b_l_b_wishbone,5,-6,0,-1.5
add limb b_l_b_wishbone,6,1
offset limb b_l_b_wishbone,6,6,0,-1.5
color object b_l_b_wishbone,rgb(255,0,0)
color limb b_l_b_wishbone,3,rgb(255,255,255)
color limb b_l_b_wishbone,4,rgb(255,255,255)
color limb b_l_b_wishbone,5,rgb(255,255,255)
color limb b_l_b_wishbone,6,rgb(255,255,255)
position object b_l_b_wishbone,b_l_b_wishbone_posx+posx#,b_l_b_wishbone_posy+posy#,b_l_b_wishbone_posz+posz#
delete mesh 2
endfunction
function make_b_r_hub(posx#,posy#,posz#)
make object box b_r_hub,4,1,1
make object box 1000,2,5,2
make mesh from object 2,1000
delete object 1000
position object b_r_hub,b_r_hub_posx+posx#,b_r_hub_posy+posy#,b_r_hub_posz+posz#
add limb b_r_hub,1,2
color object b_r_hub,rgb(0,255,0)
delete mesh 2
endfunction
function make_b_l_hub(posx#,posy#,posz#)
make object box b_l_hub,4,1,1
make object box 1000,2,5,2
make mesh from object 2,1000
delete object 1000
position object b_l_hub,b_l_hub_posx+posx#,b_l_hub_posy+posy#,b_l_hub_posz+posz#
add limb b_l_hub,1,2
color object b_l_hub,rgb(0,255,0)
delete mesh 2
endfunction
function make_f_r_upright(posx#,posy#,posz#)
make object box f_r_upright,2,5,2
make object box 1000,4,1,1
make mesh from object 2,1000
delete object 1000
add limb f_r_upright,1,2
offset limb f_r_upright,1,2.0,2.0,0.0
add limb f_r_upright,2,2
offset limb f_r_upright,2,2.0,-2.0,0.0
add limb f_r_upright,3,1
offset limb f_r_upright,3,3.5,1.5,0,0
add limb f_r_upright,4,1
offset limb f_r_upright,4,3.5,-1.5,0,0
position object f_r_upright,f_r_upright_posx+posx#,f_r_upright_posy+posy#,f_r_upright_posz+posz#
color object f_r_upright,rgb(0,255,0)
color limb f_r_upright,3,rgb(255,255,255)
color limb f_r_upright,4,rgb(255,255,255)
delete mesh 2
endfunction
function make_f_l_upright(posx#,posy#,posz#)
make object box f_l_upright,2,5,2
make object box 1000,4,1,1
make mesh from object 2,1000
delete object 1000
add limb f_l_upright,1,2
offset limb f_l_upright,1,-2.0,2.0,0.0
add limb f_l_upright,2,2
offset limb f_l_upright,2,-2.0,-2.0,0.0
add limb f_l_upright,3,1
offset limb f_l_upright,3,-3.5,1.5,0,0
add limb f_l_upright,4,1
offset limb f_l_upright,4,-3.5,-1.5,0,0
position object f_l_upright,f_l_upright_posx+posx#,f_l_upright_posy+posy#,f_l_upright_posz+posz#
color object f_l_upright,rgb(0,255,0)
color limb f_l_upright,3,rgb(255,255,255)
color limb f_l_upright,4,rgb(255,255,255)
delete mesh 2
endfunction
function make_f_r_wheel(posx#,posy#,posz#)
make object cylinder f_r_wheel,8
``scale object f_r_wheel,100,25,100
zrotate object f_r_wheel,90
texture object f_r_wheel,1
position object f_r_wheel,f_r_wheel_posx+posx#,f_r_wheel_posy+posy#,f_r_wheel_posz+posz#
endfunction
function make_f_l_wheel(posx#,posy#,posz#)
make object cylinder f_l_wheel,8
``scale object f_l_wheel,100,25,100
zrotate object f_l_wheel,90
texture object f_l_wheel,1
position object f_l_wheel,f_l_wheel_posx+posx#,f_l_wheel_posy+posy#,f_l_wheel_posz+posz#
endfunction
function make_b_r_wheel(posx#,posy#,posz#)
make object cylinder b_r_wheel,8
``scale object b_r_wheel,100,25,100
zrotate object b_r_wheel,90
texture object b_r_wheel,1
position object b_r_wheel,b_r_wheel_posx+posx#,b_r_wheel_posy+posy#,b_r_wheel_posz+posz#
endfunction
function make_b_l_wheel(posx#,posy#,posz#)
make object cylinder b_l_wheel,8
``scale object b_l_wheel,100,25,100
zrotate object b_l_wheel,90
texture object b_l_wheel,1
position object b_l_wheel,b_l_wheel_posx+posx#,b_l_wheel_posy+posy#,b_l_wheel_posz+posz#
endfunction
function make_f_r_hub(posx#,posy#,posz#)
make object box f_r_hub,2,2,2
make object box 1000,4,1,1
make mesh from object 2,1000
delete object 1000
add limb f_r_hub,1,2
offset limb f_r_hub,1,2.0,0,0
delete mesh 2
position object f_r_hub,f_r_hub_posx+posx#,f_r_hub_posy+posy#,f_r_hub_posz+posz#
endfunction
function make_f_l_hub(posx#,posy#,posz#)
make object box f_l_hub,2,2,2
make object box 1000,4,1,1
make mesh from object 2,1000
delete object 1000
add limb f_l_hub,1,2
offset limb f_l_hub,1,-2.0,0,0
delete mesh 2
position object f_l_hub,f_l_hub_posx+posx#,f_l_hub_posy+posy#,f_l_hub_posz+posz#
endfunction
function make_joints()
`back right wishbones to chasis
phy make revolute joint j_num,chasis,b_r_t_wishbone
phy set revolute joint global anchor j_num,b_r_t_wishbone,object position x(b_r_t_wishbone)-3,object position y(b_r_t_wishbone),object position z(b_r_t_wishbone)-1
phy set revolute joint global axis j_num,b_r_t_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,rear_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,b_r_t_wishbone
phy set revolute joint global anchor j_num,b_r_t_wishbone,object position x(b_r_t_wishbone)-3,object position y(b_r_t_wishbone),object position z(b_r_t_wishbone)+1
phy set revolute joint global axis j_num,b_r_t_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,rear_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,b_r_b_wishbone
phy set revolute joint global anchor j_num,b_r_b_wishbone,object position x(b_r_b_wishbone)-3,object position y(b_r_b_wishbone),object position z(b_r_b_wishbone)-1
phy set revolute joint global axis j_num,b_r_b_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,rear_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,b_r_b_wishbone
phy set revolute joint global anchor j_num,b_r_b_wishbone,object position x(b_r_b_wishbone)-3,object position y(b_r_b_wishbone),object position z(b_r_b_wishbone)+1
phy set revolute joint global axis j_num,b_r_b_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,rear_spring
phy build revolute joint j_num
inc j_num
`back right wishbones to hub
phy make revolute joint j_num,b_r_hub,b_r_t_wishbone
phy set revolute joint global anchor j_num,b_r_t_wishbone,object position x(b_r_t_wishbone)+3,object position y(b_r_t_wishbone),object position z(b_r_t_wishbone)-1
phy set revolute joint global axis j_num,b_r_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_r_hub,b_r_t_wishbone
phy set revolute joint global anchor j_num,b_r_t_wishbone,object position x(b_r_t_wishbone)+3,object position y(b_r_t_wishbone),object position z(b_r_t_wishbone)+1
phy set revolute joint global axis j_num,b_r_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_r_hub,b_r_b_wishbone
phy set revolute joint global anchor j_num,b_r_b_wishbone,object position x(b_r_b_wishbone)+3,object position y(b_r_b_wishbone),object position z(b_r_b_wishbone)-1
phy set revolute joint global axis j_num,b_r_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_r_hub,b_r_b_wishbone
phy set revolute joint global anchor j_num,b_r_b_wishbone,object position x(b_r_b_wishbone)+3,object position y(b_r_b_wishbone),object position z(b_r_b_wishbone)+1
phy set revolute joint global axis j_num,b_r_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
`back left wishbones to chasis
phy make revolute joint j_num,chasis,b_l_t_wishbone
phy set revolute joint global anchor j_num,b_l_t_wishbone,object position x(b_l_t_wishbone)+3,object position y(b_l_t_wishbone),object position z(b_l_t_wishbone)-1
phy set revolute joint global axis j_num,b_l_t_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,rear_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,b_l_t_wishbone
phy set revolute joint global anchor j_num,b_l_t_wishbone,object position x(b_l_t_wishbone)+3,object position y(b_l_t_wishbone),object position z(b_l_t_wishbone)+1
phy set revolute joint global axis j_num,b_l_t_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,rear_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,b_l_b_wishbone
phy set revolute joint global anchor j_num,b_l_b_wishbone,object position x(b_l_b_wishbone)+3,object position y(b_l_b_wishbone),object position z(b_l_b_wishbone)-1
phy set revolute joint global axis j_num,b_l_b_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,rear_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,b_l_b_wishbone
phy set revolute joint global anchor j_num,b_l_b_wishbone,object position x(b_l_b_wishbone)+3,object position y(b_l_b_wishbone),object position z(b_l_b_wishbone)+1
phy set revolute joint global axis j_num,b_l_b_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,rear_spring
phy build revolute joint j_num
inc j_num
`back left wishbones to hub
phy make revolute joint j_num,b_l_hub,b_l_t_wishbone
phy set revolute joint global anchor j_num,b_l_t_wishbone,object position x(b_l_t_wishbone)-3,object position y(b_l_t_wishbone),object position z(b_l_t_wishbone)-1
phy set revolute joint global axis j_num,b_l_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_l_hub,b_l_t_wishbone
phy set revolute joint global anchor j_num,b_l_t_wishbone,object position x(b_l_t_wishbone)-3,object position y(b_l_t_wishbone),object position z(b_l_t_wishbone)+1
phy set revolute joint global axis j_num,b_l_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_l_hub,b_l_b_wishbone
phy set revolute joint global anchor j_num,b_l_b_wishbone,object position x(b_l_b_wishbone)-3,object position y(b_l_b_wishbone),object position z(b_l_b_wishbone)-1
phy set revolute joint global axis j_num,b_l_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_l_hub,b_l_b_wishbone
phy set revolute joint global anchor j_num,b_l_b_wishbone,object position x(b_l_b_wishbone)-3,object position y(b_l_b_wishbone),object position z(b_l_b_wishbone)+1
phy set revolute joint global axis j_num,b_l_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
`front right wishbones to chasis
phy make revolute joint j_num,chasis,f_r_t_wishbone
phy set revolute joint global anchor j_num,f_r_t_wishbone,object position x(f_r_t_wishbone)-6,object position y(f_r_t_wishbone),object position z(f_r_t_wishbone)-1
phy set revolute joint global axis j_num,f_r_t_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,front_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,f_r_t_wishbone
phy set revolute joint global anchor j_num,f_r_t_wishbone,object position x(f_r_t_wishbone)-6,object position y(f_r_t_wishbone),object position z(f_r_t_wishbone)+1
phy set revolute joint global axis j_num,f_r_t_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,front_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,f_r_b_wishbone
phy set revolute joint global anchor j_num,f_r_b_wishbone,object position x(f_r_b_wishbone)-6,object position y(f_r_b_wishbone),object position z(f_r_b_wishbone)-1
phy set revolute joint global axis j_num,f_r_b_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,front_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,f_r_b_wishbone
phy set revolute joint global anchor j_num,f_r_b_wishbone,object position x(f_r_b_wishbone)-6,object position y(f_r_b_wishbone),object position z(f_r_b_wishbone)+1
phy set revolute joint global axis j_num,f_r_b_wishbone,0,0,1
phy set revolute joint spring j_num,0.1,front_spring
phy build revolute joint j_num
inc j_num
`front left wishbones to chasis
phy make revolute joint j_num,chasis,f_l_t_wishbone
phy set revolute joint global anchor j_num,f_l_t_wishbone,object position x(f_l_t_wishbone)+6,object position y(f_l_t_wishbone),object position z(f_l_t_wishbone)-1
phy set revolute joint global axis j_num,f_l_t_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,front_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,f_l_t_wishbone
phy set revolute joint global anchor j_num,f_l_t_wishbone,object position x(f_l_t_wishbone)+6,object position y(f_l_t_wishbone),object position z(f_l_t_wishbone)+1
phy set revolute joint global axis j_num,f_l_t_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,front_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,f_l_b_wishbone
phy set revolute joint global anchor j_num,f_l_b_wishbone,object position x(f_l_b_wishbone)+6,object position y(f_l_b_wishbone),object position z(f_l_b_wishbone)-1
phy set revolute joint global axis j_num,f_l_b_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,front_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,chasis,f_l_b_wishbone
phy set revolute joint global anchor j_num,f_l_b_wishbone,object position x(f_l_b_wishbone)+6,object position y(f_l_b_wishbone),object position z(f_l_b_wishbone)+1
phy set revolute joint global axis j_num,f_l_b_wishbone,0,0,1
phy set revolute joint spring j_num,-0.1,front_spring
phy build revolute joint j_num
inc j_num
`front right wishbones to upright
phy make revolute joint j_num,f_r_upright,f_r_t_wishbone
phy set revolute joint global anchor j_num,f_r_t_wishbone,object position x(f_r_t_wishbone)+3,object position y(f_r_t_wishbone),object position z(f_r_t_wishbone)-1
phy set revolute joint global axis j_num,f_r_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_r_upright,f_r_t_wishbone
phy set revolute joint global anchor j_num,f_r_t_wishbone,object position x(f_r_t_wishbone)+3,object position y(f_r_t_wishbone),object position z(f_r_t_wishbone)+1
phy set revolute joint global axis j_num,f_r_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_r_upright,f_r_b_wishbone
phy set revolute joint global anchor j_num,f_r_b_wishbone,object position x(f_r_b_wishbone)+3,object position y(f_r_b_wishbone),object position z(f_r_b_wishbone)-1
phy set revolute joint global axis j_num,f_r_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_r_upright,f_r_b_wishbone
phy set revolute joint global anchor j_num,f_r_b_wishbone,object position x(f_r_b_wishbone)+3,object position y(f_r_b_wishbone),object position z(f_r_b_wishbone)+1
phy set revolute joint global axis j_num,f_r_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
`front left wishbones to upright
phy make revolute joint j_num,f_l_upright,f_l_t_wishbone
phy set revolute joint global anchor j_num,f_l_t_wishbone,object position x(f_l_t_wishbone)-3,object position y(f_l_t_wishbone),object position z(f_l_t_wishbone)-1
phy set revolute joint global axis j_num,f_l_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_l_upright,f_l_t_wishbone
phy set revolute joint global anchor j_num,f_l_t_wishbone,object position x(f_l_t_wishbone)-3,object position y(f_l_t_wishbone),object position z(f_l_t_wishbone)+1
phy set revolute joint global axis j_num,f_l_t_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_l_upright,f_l_b_wishbone
phy set revolute joint global anchor j_num,f_l_b_wishbone,object position x(f_l_b_wishbone)-3,object position y(f_l_b_wishbone),object position z(f_l_b_wishbone)-1
phy set revolute joint global axis j_num,f_l_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_l_upright,f_l_b_wishbone
phy set revolute joint global anchor j_num,f_l_b_wishbone,object position x(f_l_b_wishbone)-3,object position y(f_l_b_wishbone),object position z(f_l_b_wishbone)+1
phy set revolute joint global axis j_num,f_l_b_wishbone,0,0,1
phy build revolute joint j_num
inc j_num
`front left upright to hub
phy make revolute joint j_num,f_l_upright,f_l_hub
phy set revolute joint global anchor j_num,f_l_hub,object position x(f_l_hub),object position y(f_l_hub)+1,object position z(f_l_hub)
phy set revolute joint global axis j_num,f_l_hub,0,1,0
phy set revolute joint spring j_num,0.0,steering_return_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_l_upright,f_l_hub
phy set revolute joint global anchor j_num,f_l_hub,object position x(f_l_hub),object position y(f_l_hub)-1,object position z(f_l_hub)
phy set revolute joint global axis j_num,f_l_hub,0,1,0
phy set revolute joint spring j_num,0.0,steering_return_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_r_upright,f_r_hub
phy set revolute joint global anchor j_num,f_r_hub,object position x(f_r_hub),object position y(f_r_hub)+1,object position z(f_r_hub)
phy set revolute joint global axis j_num,f_r_hub,0,1,0
phy set revolute joint spring j_num,0.0,steering_return_spring
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_r_upright,f_r_hub
phy set revolute joint global anchor j_num,f_r_hub,object position x(f_r_hub),object position y(f_r_hub)-1,object position z(f_r_hub)
phy set revolute joint global axis j_num,f_r_hub,0,1,0
phy set revolute joint spring j_num,0.0,steering_return_spring
phy build revolute joint j_num
inc j_num
`wheels
phy make revolute joint j_num,f_r_hub,f_r_wheel
phy set revolute joint global anchor j_num,f_r_Wheel,object position x(f_r_Wheel)-3,object position y(f_r_Wheel),object position z(f_r_Wheel)
phy set revolute joint global axis j_num,f_r_Wheel,1,0,0
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,f_l_hub,f_l_wheel
phy set revolute joint global anchor j_num,f_l_Wheel,object position x(f_l_Wheel)+3,object position y(f_l_Wheel),object position z(f_l_Wheel)
phy set revolute joint global axis j_num,f_l_Wheel,1,0,0
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_r_hub,b_r_wheel
phy set revolute joint global anchor j_num,b_r_Wheel,object position x(b_r_Wheel)-4,object position y(b_r_Wheel),object position z(b_r_Wheel)
phy set revolute joint global axis j_num,b_r_Wheel,1,0,0
phy build revolute joint j_num
inc j_num
phy make revolute joint j_num,b_l_hub,b_l_wheel
phy set revolute joint global anchor j_num,b_l_Wheel,object position x(b_l_Wheel)+4,object position y(b_l_Wheel),object position z(b_l_Wheel)
phy set revolute joint global axis j_num,b_l_Wheel,1,0,0
phy build revolute joint j_num
inc j_num
endfunction
function make_physx_objects(a,b)
for l=a to b
if l<>f_r_wheel and l<>f_l_wheel and l<>b_r_wheel and l<>b_l_wheel and object exist(l)
phy make rigid body dynamic box l
phy update rigid body mass l,0,100.0
else
``if l=chasis then phy make rigid body static box chasis
if l=f_r_wheel then phy make rigid body dynamic capsule l
if l=f_l_wheel then phy make rigid body dynamic capsule l
if l=b_r_wheel then phy make rigid body dynamic capsule l
if l=b_l_wheel then phy make rigid body dynamic capsule l
phy set rigid body max angular velocity l,100
phy update rigid body mass l,0,100.0
phy set rigid body angular damping l,2
endif
next l
endfunction
function make_floor(obj_num)
make object box obj_num,5000,1,5000
scale object texture obj_num,10,10
texture object obj_num,1
phy make rigid body static box obj_num
endfunction
function make_texture1(img_num)
for y=0 to 255
for x=0 to 255
col=rnd(50)+50
dot x,y,rgb(col,col,col)
next x
next y
get image img_num,0,0,255,255
endfunction