ok i got it to work thanks for your help BlobVanDam
@tom0001 here is the entire code. it wont work though because you dont have the right media files it has physics collision acceleration it's pretty cool (I didn't make it all though)
`------------------
` **Game setup**
`------------------
Sync on : Sync rate 60
Set Display mode 1024,768,16 : Hide Mouse
Autocam off : Set Camera Range 1,0x7fffffff
fog on
fog distance 13000
`Setup Types
Type Vector
X as Float
Y as Float
Z as Float
Endtype
load object "C:UsersCalebDocumentsdriftcity.x", 2
scale object 2, 40,40,40
position object 2, 2000,-100,2000
make light 22
position light 22, 0,300,0
SC_SetupObject 2,0,0
`--------------------
` **Setup Player**
`--------------------
` —Variables
Global MDir as Vector `Direction of movement
Global Vel as Vector `Velocity
Global Acc as Vector `Acceleration
Global Force as Vector `Force
Global Drag as Vector `Drag
Global Traction as Vector `Traction
Global AngForce as Vector `Angular force
Global AngAcc as Vector `Angular Acceleration
Global AngVel as Vector `Angular Velocity
Global Angle as Vector `Angle
Global Pos as Vector `Position
Global Speed as Float `Speed
` —Constants
Global EngForce `Engine Force
Global Mass as Float `Mass
Global CDrag as Float `Constant Drag
Global CTraction as Float `Constant Traction
Global ATraction as Float `Angular Constant Traction
Global Spd as float
Spd =(speed*1.5)
`---------------------
` **Configuration**
`---------------------
EngForce=600
Mass=900
CDrag=0.27
CTraction=0.98
ATraction=0.98
`--------------
` **Create**
`--------------
`Create Player Vehicle
load object "C:Program FilesThe Game CreatorsFPS CreatorFilesentitybankeai_crownvicCrownvic.X", 1
xrotate object 1, 180
`Create World
Make Matrix 23,10000,100,50,50
`----------------
` ))Main Loop((
`----------------
Do
if Spd<0.001 then spd=0.0 else spd=(speed*3.5)
TEXT 0,0,str$(screen fps())
Text 0,80,"Speed: " + str$(Speed*3.0)
`Store the user's old position on the xyz axis
OX# = OBJECT POSITION X(1)
OY# = OBJECT POSITION Y(1)
OZ# = OBJECT POSITION Z(1)
`----------------
` **Controls**
`----------------
If Upkey()=1 then up=1 else up=0
If Downkey()=1 then down=1 else down=0
If Leftkey()=1 then left=1 else left=0
If Rightkey()=1 then right=1 else right=0
`Apply Forces When Controls Are Pressed
if Up=1
Force.X=Traction.X+Drag.X
Force.Y=Traction.Y+Drag.Y
Force.Z=Traction.Z+Drag.Z
else if down=1
Force.X=-Traction.X-Drag.X
Force.Y=-Traction.Y-Drag.Y
Force.Z=-Traction.Z-Drag.Z
else
Force.X=0
Force.Y=0
Force.Z=0
endif
endif
If Left=1 Then AngForce.Y=-(Speed/0.6)
If Right=1 then AngForce.Y=(Speed/0.6)
If Left=0 and Right=0 then AngForce.Y=0
`---------------
` **Physics**
`---------------
`Direction
MDir.X = Sin(Angle.Y) * Cos(Angle.X)
MDir.Y = -Sin(Angle.X)
MDir.Z = Cos(Angle.Y) * Cos(Angle.X)
`Forces
Traction.X=MDir.X * EngForce
Traction.Y=MDir.Y * EngForce
Traction.Z=MDir.Z * EngForce
Drag.X=-CDrag * Vel.X * Speed
Drag.Y=-CDrag * Vel.Y * Speed
Drag.Z=-CDrag * Vel.Z * Speed
`Movement
Acc.X = Force.X / Mass
Acc.Y = Force.Y / Mass
Acc.Z = Force.Z / Mass
Vel.X = (Vel.X + Acc.X) * CTraction
Vel.Y = (Vel.Y + Acc.Y) * CTraction
Vel.Z = (Vel.Z + Acc.Z) * CTraction
Speed=SQRT( Vel.X^2 + Vel.Y^2 + Vel.Z^2)
`Angles
AngAcc.X = AngForce.X / Mass
AngAcc.Y = AngForce.Y / Mass
AngAcc.Z = AngForce.Z / Mass
AngVel.X = (AngVel.X + AngAcc.X) * ATraction
AngVel.Y = (AngVel.Y + AngAcc.Y) * ATraction
AngVel.Z = (AngVel.Z + AngAcc.Z) * ATraction
`Apply Physics To Player
Pos.X=Pos.X+Vel.X
Pos.Y=Pos.Y+Vel.Y
Pos.Z=Pos.Z+Vel.Z
Angle.X = Wrapvalue( Angle.X + AngVel.X )
Angle.Y = Wrapvalue( Angle.Y + AngVel.Y )
Angle.Z = Wrapvalue( Angle.Z + AngVel.Z )
`Update player
Pos.Y=Get Ground Height(23,Pos.X,Pos.Z)+30
Position Object 1, Pos.X, Pos.Y, Pos.Z
Rotate object 1, Angle.X, Angle.Y+180, Angle.Z
`--------------
` **Camera**
`--------------
ca# = curveangle(Angle.Y,ca#,16.0)
cx#=pos.x-Sin(ca#)*600
cy#=pos.y+150
cz#=pos.z-Cos(ca#)*600
position camera cx#,cy#,cz#
point camera pos.x,pos.y,pos.z
`Store the player's new position on the xyz axis, after they've moved.
X# = OBJECT POSITION X(1)
Y# = OBJECT POSITION Y(1)
Z# = OBJECT POSITION Z(1)
SlidingCollision(OX#,OY#,OZ#,X#,Y#,Z#,10,1,2)
Sync
Loop
`-----------------
` ))Main Loop((
`-----------------
`Sliding Collision Function
FUNCTION SlidingCollision(X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,Dyn,Obj)
C = sc_SphereSlide(Obj,X1#,Y1#,Z1#,X2#,Y2#,Z2#,Radius#,0)
IF C > 0
cx# = sc_getCollisionSlideX()
cy# = sc_getCollisionSlideY()
cz# = sc_getCollisionSlideZ()
POSITION OBJECT Dyn, cx#, cy#, cz#
ENDIF
ENDFUNCTION
`This last bit is a requirement of Sparky's dll. Basically, DBP's commands are grouped into plugins themselves.
`Theres a plugin for Camera commands, a plugin for Object commands, a plugin for Network commands, etc.
`However DBP, at the time of writing, includes only the necassary plugins for the program to work. So if you dont use
`and 3D commands, it wont include any 3D plugins. Sparky's dll requires the memblock commands, we haven't used any
`memblock commands yet so DBP wont include the Memblock plugin, which means Sparky's dll will crash. To fix this, we
`just add a DELETE MEMBLOCK 1 command after the function. DBP will never read this code, and so it will never get
`executed, but it will make DBP include the Memblock plugin.
`If you've used a memblock command elsewhere in your project, then you wont need this.
DELETE MEMBLOCK 1
"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 2 Gb RAM GeForce 9600 512 mb