Little EntityCollided issue!

Blitz3D Forums/Blitz3D Programming/Little EntityCollided issue!

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?

What is your collisions command?

collisions type_camera,type_weapon,2,2

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...

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?

1) CountCollisions
2) Did you put a call to UpdateWorld?

Yes, all collisions behave normally (like walking stairs, and it doesn't fall throught the ground), except the one that uses EntityCollide.

maybe you missed an entityradius command somewhere or something real simple :)

Yeah, I suppose I've missed something simple, but the big problem is finding what. EntityRadius is there.

Hmm, seems like EntityCollided only works when I'm NOT calling UpdateWorld! Weird!!!

Any workaround on that? I definitly need UpdateWorld...

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.

"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 :)