I have a small little problem.
I made an engine, using Dark Physics, and I have a little collision program. This is what I've tried to achieve:
-to be able to walk on a big green box(achieved)
-to be abble to collide with a big grey box in the middle of the playfield(achieved)
-to be able to fly on top of the grey box in the middle of the playfield(not achieved)
I've tried everything. If I put my character on the top of the grey box in the beginning of the level, I can easily walk on it, and I can fall down from it, but if I start from the green playfield, and use the JUMP function(which is more precisesly a fly function), I can't get on top of the grey box no matter how high up I put the y position of my player box... here's the code, I would really apreciate if anyone could help me.
REM Project: omegatest
REM Created: 5/14/2008 10:59:32 PM
REM
REM ***** Main Source File *****
REM
REM --- Activating sync and physics, turning of autocam ---
sync on
sync rate 40
autocam off
AI START
PHY START
REM ---
REMSTART
---- NOT YET USED COMMANDS ----
global gun
type gm
actgun as integer
gun1 as integer
gun2 as integer
gun3 as integer
gun4 as integer
endtype
weapon as gm
weapon.actgun=99999;
REMEND
REM --- IDS ---
player=100000
level=888888;
gun=999999;
REM ---
REM --- Making the floor ---
make object box level, 1000, 1, 1000
position object level, 0,0,0
color object level, RGB(0,255,0)
phy make rigid body static box level
REM --- Making an obstacle ---
make object box 5, 100, 100, 100
position object 5, 0, 0, 200
position object 5, 0, 0, 200
phy make rigid body static mesh 5
REM --- Spawning player ---
make object box player, 10, 30, 10
phy make box character controller player, 0, 250, 250, 5, 15, 5, 1, 2, 45
REM --- Loading in gun ---
load object "deagle.x", gun
load image "ammo_D.dds", 1
load image "gun_D.dds", 2
load image "Hand_D.jpg", 3
texture object gun, 1
texture object gun, 2
texture object gun, 3
yrotate object gun, 180
loop object gun, 10, 38
lock object on gun
jump=0;
REM --- Main loop ---
do
gosub _MovePlayer
print "Pos X"
print object position x(player)
print "Pos Y"
print object position y(player)
print "Pos Z"
print object position z(player)
print "Collission"
print phy get collision data()
REM --- Refreshing the screen ---
phy update
sync
loop
_MovePlayer:
REM --- Setting up the camera and movement controls
position camera object position x(player), object position y(player)+10, object position z(player)
xmousemove=mousemovex()
ymousemove=mousemovey()
Rotate Camera (camera angle x()+ymousemove),(camera angle y()+xmousemove),0
Rotate Object player, 0,(camera angle y()+xmousemove),0
position object gun, 6, 0, 15
REM --- Moving the character forward and backward ---
REM --- Strafe is NOT IMPLEMENTED YET ---
if upkey ( )
phy move character controller player, 40.0
else
phy move character controller player, 0.0
endif
if downkey ( )
phy move character controller player, -20.0
else
phy move character controller player, 0.0
endif
REM --- FLY TEST ---
if spacekey()=1 then jump=1
if jump=1 then position object player, object position x(player), object position y(player)+220, object position z(player)
RETURN