Hey guys,
So I have a map that is the entire level and here is my set up:
map file
LoadMap:
Load Object "Map/eow.dbo", 1
SC_setupComplexObject 1 , 1 , 2
`global variable
Global ColliderObjNum As Integer
ColliderObjNum = 2
`global visual object variable
Global VisualObject As Integer
VisualObject = 3
`collider Object
Make Object Sphere ColliderObjNum, EyeHeight/2
Sc_setupObject ColliderObjNum , 0 , 1
sc_drawobjectbounds ColliderObjNum
`visual Object
Make Object Sphere VisualObject, EyeHeight/2
Color Object VisualObject,rgb(255,0,0)
`collision method
Hide Object ColliderObjNum
Set Object Collision Off VisualObject
Moving = 0
`Begin Routine
If cam=0
`accept user's input
Rotate Object ColliderObjNum, Object Angle x(ColliderObjNum)+(MouseMovey()/MouseSens),Object Angle y(ColliderObjNum)+(MouseMovex()/MouseSens),0
else
`accept user's input
Rotate Object ColliderObjNum, 0,Object Angle y(ColliderObjNum)+(MouseMovex()/MouseSens),0
Endif
`this code constitutes the mouselook functionality
If Object Angle x(ColliderObjNum)>90 then XRotate Object ColliderObjNum,90
If Object Angle x(ColliderObjNum)<-90 then XRotate Object ColliderObjNum,-90
cx#=Object Angle x(ColliderObjNum)
cy#=Object Angle y(ColliderObjNum)
cz#=Object Angle z(ColliderObjNum)
Rotate Camera cx#, cy#, cz#
Rotate Object ColliderObjNum, cx#, cy#, cz#
If UseReticle = 1
circle screen width()/2,screen height()/2,8
EndIf
oldx# = object position x(ColliderObjNum)
oldy# = object position y(ColliderObjNum)
oldz# = object position z(ColliderObjNum)
k$=upper$(Inkey$())
`This code constitutes the movement functionality
If ShiftKey() = 1
If UpKey()=1 or k$="W" then move object ColliderObjNum,3
If DownKey()=1 or k$="S" then move object ColliderObjNum,-3
If LeftKey()=1 or k$="A" then move object left ColliderObjNum,3
If RightKey()=1 or k$="D" then move object right ColliderObjNum,3
else
If UpKey()=1 or k$="W" then move object ColliderObjNum,1
If DownKey()=1 or k$="S" then move object ColliderObjNum,-1
If LeftKey()=1 or k$="A" then move object left ColliderObjNum,1
If RightKey()=1 or k$="D" then move object right ColliderObjNum,1
Endif
x# = object position x(ColliderObjNum)
y# = object position y(ColliderObjNum)
z# = object position z(ColliderObjNum)
rem player only collides with group 1 (level) objs and moves freely through others
collide = sc_SphereSlideGroup(1,oldx#,oldy#,oldz#,x#,y#,z#,radius#,0)
If collide > 0
rem if hit, reposition player, halt movement vector
x# = sc_getCollisionSlideX()
y# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
rem re-position the player
position object ColliderObjNum , x# , y# , z#
Endif
If collide = 0
rem push player to the ground if player does not touch the level (in air)
Move Object Down ColliderObjNum , .4
ENDIF
sc_updateObject ColliderObjNum
Any ideas on why I just go though the map?
Cheers.
God help me, Please.
