I tried using the phy get collision data command, but it returns a 0 everytime even though 2 objects are clearly colliding with eachother in my game. Heres my code:
`--------------------------
function updateCollisions()
`--------------------------
`Updates collisions between objects
dim collisionObjects(2)
dim collisionObjectFound(2)
dim collisionObjectType$(2)
dim collisionObjectID(2)
while phy get collision data()=1
end
collisionObjects(1)=phy get collision object a()
collisionObjects(2)=phy get collision object b()
collisionObjectFound(1)=0
collisionObjectFound(2)=0
for x=1 to 2
if collisionObjects(x)=player
collisionObjectFound(x)=1
collisionObjectType$(x)="player"
endif
next x
for x=1 to 2
if collisionObjectFound(x)=0
for y=1 to enemies
if collisionObjects(x)=enemyID(y)
collisionObjectFound(x)=1
collisionObjectType$(x)="enemy"
collisionObjectID(x)=y
exit
endif
next y
endif
next x
if collisionObjectType$(1)="player" and collisionObjectType$(2)="enemy"
handleCollisionPlayerEnemy(collisionObjectID(2))
endif
if collisionObjectType$(1)="enemy" and collisionObjectType$(2)="player"
handleCollisionPlayerEnemy(collisionObjectID(1))
endif
endwhile
`----------
endfunction
`----------
`---------------------------------------------
function makeEnemy(x#,y#,z#,ax#,ay#,az#,class)
`---------------------------------------------
`Creates an enemy with the specified parameters
inc enemies
dim enemyID(enemies)
dim enemyClass(enemies)
dim enemyVelocityy#(enemies)
dim enemyOldy#(enemies)
enemyID(enemies)=freeObject()
enemyClass(enemies)=class
load object enemyClassFile$(class),enemyID(enemies)
sizeObject(enemyID(enemies),enemyClassSizex#(class),enemyClassSizey#(class),enemyClassSizez#(class))
position object enemyID(enemies),x#,y#,z#
phy make box character controller enemyID(enemies),x#,y#,z#,enemyClassSizex#(class),enemyClassSizey#(class)/2.0,enemyClassSizez#(class),1,5.25,22.5
ai add enemy enemyID(enemies),0
ai set entity speed enemyID(enemies),enemyClassSpeed#(class)
ai set entity aggressive enemyID(enemies)
ai set entity attack distance enemyID(enemies),enemyClassAttackDist#(class)
ai set entity view range enemyID(enemies),400.0
ai set entity position enemyID(enemies),x#,z#
`----------
endfunction
`----------
`----------------------------
function makePlayer(x#,y#,z#)
`----------------------------
`Creates the player object as well as objects related to the player object
player=freeObject()
make object box player,10,25,10
hide object player
phy make box character controller player,x#,y#,z#,playerWidth#,playerStandingHeight#,playerWidth#,1,5.25,22.5
ai add player player
makeGun()
makeCrosshair()
`----------
endfunction
`----------
Does anyone know what the problem is? Thanks.
Your signature has been erased by a mod becuase it doesnt conform to 600 x 120 in size