Thanks for your sugestions but they dont seem to be working as i'd expect them to.I've been trying this off and on for a few days now and this is as far as ive got and i seem to be getting there except for one minor bug.
what i've ended up doing,because for some reason the wheels were always driven at 90 degrees to the vehicle and the rotate object commands,even when used with a fix object pivot command seem to be ignored by the physx engine is this.
1. make an object as a place holder for the vehicle
2. make a limb(1) to represent the vehicle body,it only seems to like it made onlong the z axis at present,though i will try others later.
3. add the wheel limbs,back right(2),back left(3),front right(4),front left(5),then link limbs to limb (1) the body
4. rotate limb(1) 90 degrees around its y axis
5. add the body to physx vehicle
6. add the wheels in this order back right,back left,front right,
front left
7. set up rest of vehicle properties and build it
now this seems to work,it points in the right direction,goes in the right direction,even the wheels spin in the right direction,it just doesnt turn properly.
sync on
sync rate 60
autocam off
color backdrop 0, 0
set text font "Arial"
set text size 12
set text transparent
position camera 50,400,-400
point camera 0,0,0
phy start
`floor
make object box 1000,5000,1,5000
position object 1000,0,-30,0
phy make rigid body static box 1000
`make object box 1002,100,1.01,100
`position object 1002,0,-30,0
`phy make rigid body static box 1002
`color object 1002,rgb(0,255,255)
`
``pole
`make object box 1001,20,30,20
`position object 1001,40,-30,0
`phy make rigid body static box 1001
`color object 1001,rgb(0,0,0)
`set up a basic car model
set_up_car(1,0,16,0)
do
MouseControl(5.0)
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 set_up_car(obj,posx,posy,posz)
width=30
height=10
depth=10
local wheel_size as float=15.0
local r as float=2.0
local h as float=12.0
`body
make object box obj,width,height,depth
color object obj,rgb(255,0,255)
position object obj,posx,posy,posz
make object cube obj+1,1
make mesh from object 1,obj+1
add limb obj,1,1
delete mesh 1
delete object obj+1
`mesh for wheel limbs
make object cube obj+1,wheel_size
make mesh from object 1,obj+1
`create wheels along the x axis and offset the limbs to desired corner
`br
add limb obj,2,1:offset limb obj,2,-20,-2.99,20:color limb obj,2,rgb(255,0,0)
link limb obj,1,2
`bl
add limb obj,3,1:offset limb obj,3,20,-2.99,20:color limb obj,3,rgb(0,255,0)
link limb obj,1,3
`fr
add limb obj,4,1:offset limb obj,4,-20,-2.99,-20:color limb obj,4,rgb(0,0,255)
link limb obj,1,4
`fl
add limb obj,5,1:offset limb obj,5,20,-2.99,-20:color limb obj,5,rgb(255,255,0)
link limb obj,1,5
delete mesh 1
delete object obj+1
rotate limb obj,1,0,-90,0
phy create vehicle obj
phy add vehicle body obj,width,height,depth,0,0,0
`br
phy add vehicle wheel obj,2,-20,-2.99,-20,wheel_size/r,0.01,0,1
`bl
phy add vehicle wheel obj,3,-20,-2.99,20,wheel_size/r,0.01,0,1
`fr
phy add vehicle wheel obj,4,20,-2.99,-20,wheel_size/r,0.01,1,1
`fl
phy add vehicle wheel obj,5,20,-2.99,20,wheel_size/r,0.01,1,1
phy set vehicle static friction obj,5.0
phy set vehicle dynamic friction obj,0.5
phy set vehicle max motor obj,400.0
phy set vehicle steering delta obj,0.25
phy set vehicle max steering angle obj,1.0
phy set vehicle auto obj,1
`phy set vehicle mass obj,500
phy set vehicle suspension spring obj,100
phy build vehicle obj
endfunction