Hey guys, I have been having some problems with the character control commands in DarkPhysx. The problem I have is that I can't get my character (ninja) to stop when it collides with the cube. Thanks.
REM Project: Star Wars RPG
REM Created: 1/9/2007 4:16:02 PM
REM
REM ***** Main Source File *****
REM
gosub Menu
NewGame:
cls
sync on
hide mouse
sync rate 60
setbackdrop(128,128,128)
setfog(128,128,128,1000)
phy start
REM Load and Ready the player
load object "models\character1\static.x",1
darkmatter_append_object("models\character1\idle.x",1,1)
darkmatter_append_object("models\character1\move.x",1,26)
darkmatter_append_object("models\character1\die.x",1,51)
darkmatter_append_object("models\character1\attack.x",1,101)
set object speed 1,35
scale object 1,1000,1000,1000
rotate object 1,0,180,0
fix object pivot 1
phy make capsule character controller 1, 0, 10, 0, 10, 10, 1, 1.5, 45.0
REM Load, Make, and Texture a Matrix (our map)
load image "textures\grass.jpg",1
load image "textures\quest.jpg",2
make matrix 1,15000,15000,20,20
texture_matrix(1,1,1,1,1)
randomize matrix 1,300
update matrix 1
make object cube 2,50
position object 2,300,get ground height(1,300,300)+25,300
phy make rigid body static box 2
REM Player State
playerstate = 1
do
set cursor 0,0
Print Screen FPS()
Print statistic(1)
if mouseclick()=1 then playerstate = 2
if keystate(17)=1 then playerstate = 1
select playerstate
case 1
if keystate (17)=1 and shiftkey()=0 then player_animation_loop_darkmatter(1,27,51)
if keystate (17)=0 then loop object 1,1,26
endcase
case 2
if mouseclick()=1 and shiftkey()=0 then play object 1,101,126
if mouseclick()=0 and object playing (1)=0 then play object 1,1,26
endcase
endselect
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleX# = WrapValue(CameraAngleY#+MousemoveY()*.7)
CameraAngleY# = WrapValue(CameraAngleX#+MousemoveX()*.7)
yrotate object 1, CurveAngle(CameraAngleY#,OldCamAngleY#,24)
yrotate object 1, CurveAngle(CameraAngleX#,OldCamAngleX#,24)
player_move(1,2,1,1,1)
phy update
sync
loop
function player_move(playerobject_number#,playerobject_speed#, playerobject_reducedspeed#, matrix_number,control_number)
REM Get the players x,y,z angles...
playeryangle# = object angle y(playerobject_number#)
playerxangle# = object angle x(playerobject_number#)
playerzangle# = object angle z(playerobject_number#)
REM Get the players x,y,z positions....
playeryposition# = get matrix height(matrix_number,playerxposition#,playeryposition#)
playerxposition# = object position x(playerobject_number#)
playerzposition# = object position z(playerobject_number#)
if keystate (17)=1 and shiftkey()=0 then phy move character controller control_number, 10.0
if keystate (17)=1 and shiftkey()=1 then move object playerobject_number#,playerobject_speed# - playerobject_reducedspeed#
AngleY# = object angle y(playerobject_number#)
X# = Object position x(playerobject_number#)
Z# = Object position z(playerobject_number#)
Y# = Get Ground Height(1,X#,Z#)
Position object playerobject_number#,X#,Y#,Z#
CameraZ# = Newzvalue(Z#,AngleY#-180,50)
CameraX# = Newxvalue(X#,AngleY#-180,50)
CameraY# = Get Ground Height(matrix_number,CameraX#,CameraZ#)
Position camera CameraX#,CameraY#+30,CameraZ#
Point camera X#,Y#+10,Z#
endfunction