Collision, but different

Blitz3D Forums/Blitz3D Programming/Collision, but different

Jeroen(Posted 2003) [#1]
Hi!

I have a problem with collisions.
Let's say player 1 can project a mesh on someone else, in this game ment as a selection to "challenge" the other player using a cone shaped mesh (only textured the top of it).



The cone shaped mesh is a child of the actual player, so it rotates with it.

The problem is there is no collision detected. Only when the other player jumps OUT of the cone ONTO the top of the cone, suddenly there is collision.

Basicly it seems it doesn't check for "real" intersection. How can I fix this problem?


Shambler(Posted 2003) [#2]
Try meshesintersect().


Jeroen(Posted 2003) [#3]
I heared that it is a very slow function and that it should be used with caution. Whenever possible, I'd prefer to avoid that.


semar(Posted 2003) [#4]
@Jeroen,
you can use a second mesh which covers the cone surface, make it invisible, and parent it with the cone.

Then move it continuously up and down, so it will intercept collisions with the other player.

I try to explain it better.

Put an object on a table, then put your hand on it, but without touching the object. This is what your cone does now, it does not intercept any collision between the object and the hand.

Now move your hand up and down continuously, so that it touches the object on the table when goes full down, and does not touch it when goes full up.

See ? Each time your hand hits the object, you have a collision. Now think that your hand is the second mesh I've talked above..

Alternatively, you can use 2D collisions. Since you know where the cone and the player are, in terms of x and z coordinates, then you can use a 2D animated image for the cone (which should be a 2D cone with all the rotation frames), and a simple circle image for the player.

Then just check for imagescollide between the circle image and the cone one - at the related frame, which belongs to your player EntityYaw() angle value - at their respective x and z position, and hey presto, 2D collisions !

Hope this has sense for you,
Sergio.

(BTW, nice screenshot)


Jeroen(Posted 2003) [#5]
hmmm I think I understand.
Funny idea :)
It doesnt work yet, but that's probably because of my code.

Thanks for the compliment!