Little EntityCollided issue!

Blitz3D Forums/Blitz3D Programming/Little EntityCollided issue!

ChrML(Posted 2003) [#1]
Hi, I'm doing a pick-up-gun script now, but I have a problem with EntityCollided! This is a snip of my code:

const type_camera=1,type_weapon=2
...
entitytype camera,type_camera
entitytype weapon,type_weapon
...
while not keydown(-1)
...
if entitycollided(camera,type_weapon)<>0 then
runtimeerror "Camera and weapon collided!"
endif
...
wend



That runtimeerror is only temporarily, so I can know when the camera hits the weapon (never). If some reason it never hits the weapon. The game is first person, and the camera radius is 6. When I run over the weapon, I don't get the runtimeerror saying that it collided. What can be wrong?


Ross C(Posted 2003) [#2]
What is your collisions command?


ChrML(Posted 2003) [#3]
collisions type_camera,type_weapon,2,2


Koriolis(Posted 2003) [#4]
The collsion system has always seemed to behave...weirdly (did I say buggy?) in the few tests I made.
Try to do also
collisions type_weapon,type_camera,2,2
just in case...


ChrML(Posted 2003) [#5]
I've tried that, but with the exception of EntityCollide, are there other ways to check if collided with a specific entity then? I need to check if one entity has collided with an another with an if statement, so I can myself deside what to happen. Got any ideas on why EntityCollide won't seem to work?


Koriolis(Posted 2003) [#6]
1) CountCollisions
2) Did you put a call to UpdateWorld?


ChrML(Posted 2003) [#7]
Yes, all collisions behave normally (like walking stairs, and it doesn't fall throught the ground), except the one that uses EntityCollide.


(tu) sinu(Posted 2003) [#8]
maybe you missed an entityradius command somewhere or something real simple :)


ChrML(Posted 2003) [#9]
Yeah, I suppose I've missed something simple, but the big problem is finding what. EntityRadius is there.


ChrML(Posted 2003) [#10]
Hmm, seems like EntityCollided only works when I'm NOT calling UpdateWorld! Weird!!!


ChrML(Posted 2003) [#11]
Any workaround on that? I definitly need UpdateWorld...


ChrML(Posted 2003) [#12]
Ah, stupid me! I was doing UpdateWorld at two places in the code. One time inside a function, and one more time just before RenderWorld. Like Sinu said, it was something very simple, only a pain in the ass to figure out what.


(tu) sinu(Posted 2003) [#13]
"Hmm, seems like EntityCollided only works when I'm NOT calling UpdateWorld! Weird!!"


that made me think that updateworld was called twice/somewhere else too, only just saw the post :)