bumb.
All Im trying is attach the seperated wheel into the model. This is only the way I can see is possble when using Deled as graphics editor.
I guess I should play with add libs commands, or do I take fool?
The sourcecode was in the zip file, alone with both model (a car and a wheel).
phy start
rem your objcet size is really really BIG... but physics seen go fine.
Global Blocksize=512
Autocam off
sync on
Sync Rate 60
rem create a flat box as a track
Make Object Box 1, -BlockSize*100, 1, -BlockSize*100
Color Object 1, RGB(2, 160, 2)
Set Object Light 1,100
rem Create simple car tuning
Type CarTuning
ID
Height
WheelF_x
WheelF_z
WheelB_x
WheelB_z
DampingF#
DampingB#
EndType
Global CamMove=0
Global CamTurn=90
Global Car as Cartuning
rem both wheel and cabinet is center in all 3 axis. I do not now I should not doing that in Y axis?
Car.ID=2
Car.Height=8
Car.WheelF_x=10
Car.WheelF_z=14
Car.WheelB_x=10
Car.WheelB_z=16
Create_Car(Car)
rem position camera for look into the car
Position Camera 0, 0, 64, 0
Turn Camera Left 0, 90
Move Camera 0, BlockSize/2
Point Camera 0, 0, 0
Set Ambient Light 100
Rem Simple loop. Normally Physics would being updated here.
do
MOVED=0
if keystate(17) Then CamMove=CamMove-2 : MOVED=1
if keystate(31) Then CamMove=CamMove+2 : MOVED=1
if keystate(30) Then CamTurn=CamTurn-2 : MOVED=1
if keystate(32) Then CamTurn=CamTurn+2 : MOVED=1
if MOVED=1
Position Camera 0, 0, 64, 0
Rotate Camera 0,0,0
Turn Camera Left 0,CamTurn
Move Camera 0, BlockSize/2+CamMove
Point Camera 0, 0, 0
EndIf
sync
loop
End
Function Create_Car(NewCar as Cartuning)
If Object Exist(NewCar.ID)=0
Load Object "Car.dbo", NewCar.ID
Load Object "Wheel_Front.dbo", NewCar.ID+1
Clone Object NewCar.ID+2,NewCar.ID+1
Load Object "Wheel_Front.dbo", NewCar.ID+3
Clone Object NewCar.ID+4,NewCar.ID+3
EndIf
rem The car cabinet
Position Object NewCar.ID, 0, NewCar.Height*(Blocksize/128), 0
rem position wheels
Position Object NewCar.ID+1, -BlockSize/128*NewCar.WheelF_x, Object Size Y(NewCar.ID+1)/2, BlockSize/128*NewCar.WheelF_z
Position Object NewCar.ID+2, BlockSize/128*NewCar.WheelF_x, Object Size Y(NewCar.ID+2)/2, BlockSize/128*NewCar.WheelF_z
Position Object NewCar.ID+3, -BlockSize/128*NewCar.WheelB_x, Object Size Y(NewCar.ID+3)/2, -BlockSize/128*NewCar.WheelB_z
Position Object NewCar.ID+4, BlockSize/128*NewCar.WheelB_x, Object Size Y(NewCar.ID+4)/2, -BlockSize/128*NewCar.WheelB_z
rem ****************** HERE IM TRYING TO ADD LIBS TO THE MODEL ***********************
rem This seen not to work good, so...
rem How do I add libs between wheel and cabient. I may guess you need to doing with DB commands?
for i=1 to 4
Make Mesh From Object NewCar.ID+i, NewCar.ID+i
rem Add Limb NewCar.ID, i, NewCar.ID+i
rem Glue Object to Limb NewCar.ID, NewCar.ID+1, 1
next
rem *********************** END PROBLEM **************************************
phy create vehicle 2
phy add vehicle body 2, Object Size X(NewCar.ID), Object Size Y(NewCar.ID), NewCar.Height*(Blocksize/128), 0.0, height#, 0.0
Rem How to math the size of radius and wheelheight from a object?
rem phy add vehicle wheel 2, 1, wheelZ#, wheelY#, wheelX#, radius#, wheelHeight#, 0, 0
rem phy add vehicle wheel 2, 2, wheelZ#, wheelY#, -wheelX#, radius#, wheelHeight#, 0, 1
rem phy add vehicle wheel 2, 3, -wheelZ#, wheelY#, -wheelX#, radius#, wheelHeight#, 1, 0
rem phy add vehicle wheel 2, 4, -wheelZ#, wheelY#, wheelX#, radius#, wheelHeight#, 1, 1
rem phy set vehicle max motor 2, 200.0
rem steeringDelta# = 0.1 : phy set vehicle steering delta 2, steeringDelta#
rem phy set vehicle max steering angle 2, 0.4
rem phy set vehicle auto 2, 0
rem phy set vehicle wheel multiplier 2,0
rem phy set vehicle suspension spring 2,100
phy build vehicle 2
EndFunction
http://www.PlayITgame.org