Posted: 5th Aug 2006 05:21
Hi
Have been testing some models I previous have made using the DP vehicle commands. Have succeded in registering all limbs and positions etc required to make the engine aware of the different components (almost).
If I use the arrow keys to increase the speed and the wheels are turning but the car does not move. Using the debugger I can see that the car body is registered but I can not see the wheels. Should the be displayed too ? Suspect that there are some problems related to my handling of the wheels since increasing decreasing the body size makes the car body and wheel sink into the ground.
The program is very much based upon one of the small vehicle demos delivered with DP. I can't spot any difference that should make this behave like this (might be beacuse it is past 4 AM here..... )
` demonstrates simple creation of a vehicle
` set up program
phy enable debug
phy start
autocam off
sync on
sync rate 60
color backdrop 0
make light 1
set directional light 1, -5, -5, 5
position camera -20, 20, -25
point camera 0, 10, 0
` create ground
load image "road2.png", 1
make object box 1, 1000, 1, 1000
texture object 1, 1
phy make rigid body static box 1
` load car
load OBJECT "racer_frag.x", 2
position object 2, 15, 2, -25
rem rotate limb 2,0,0,-90,0
Height# = 0.47
Radius# = Height# / 2.0
` set up vehicle
phy create vehicle 2
phy add vehicle body 2, 1.16, 0.69 - Radius#, 2.33, 0.0, 0.0, 0.0
rem RR = limb 10
phy add vehicle wheel 2, 10, limb position x (2, 10), limb position y (2, 10), limb position z (2, 10), Radius#, Height#, 0, 1
rem RL = limb 8
phy add vehicle wheel 2, 8, limb position x (2, 8), limb position y (2, 8), limb position z (2, 8), Radius#, Height#, 0, 1
rem FR = limb 6
phy add vehicle wheel 2, 5, limb position x (2, 5), limb position y (2, 5), limb position z (2, 5), Radius#, Height#, 1, 1
rem FL = limb 4
phy add vehicle wheel 2, 3, limb position x (2, 3), limb position y (2, 3), limb position z (2, 3), Radius#, Height#, 1, 1
phy set vehicle max motor 2, 200.0
phy set vehicle steering delta 2, 0.1
phy set vehicle max steering angle 2, 0.4
phy set vehicle auto 2, 1
phy set vehicle suspension spring 2,100
phy build vehicle 2
` main loop
do
set cursor 0, 0
print Radius#, Height#
for index = 0 to 10
print limb name$(2, index)
next
` follow car
set camera to follow object position x ( 2 ), object position y ( 2 ), object position z ( 2 ), 0, 6, 4, 1, 0
` update physics and screen
phy update
sync
loop
Attachments
Login to view attachments