collision problem

(gargola) #1

oh!!! working with collision on blender is a pain!..i made an enemy…so when my player collides with the enemy,my player “dies”.the problem is that the bounding box of the enemy is too big and when my player gets near the enemy my players dies even if it’s not too close.i want my player to die when it touches the enemy(not when he is like 10 feet away from the enemy).i tried the touch sensor…doesn’t work(don’t know why,when my player touch the enemy,nothing happens,even if i assigned a material to the eenemy) i tried reducing the bounding box size,but then the legs of the enemy goes below the ground(the floor)so i need to make the box bigger to prevent that from happen.anybody got an idea to fix this problem? please help…if you need to see the game,please tell me and i’ll make a link. thanx! :slight_smile:

(wiseman303) #2

try moving the bounding sphere so that it just surrounds the enemy’s feet. Then you can use a much smaller sphere without the enemy falling through the floor.

(gargola) #3

i tried that…moved the bounding box to the feet and made it very small,now i don’t have the floor problem,but the character still dies when it’s too far from the enemy! that’s weird! what’s wrong? please help! :frowning:

(gargola) #4

well,here is a link to the game file,anybody who want to help me,please have a look: thanx! :slight_smile:

(Pooba) #5

Stuff like this pisses me off. I had the exact same problem and I couldn’t fix it either. The problem was in my cat game and I had it so that when I collided with my enemy it would lower my cat’s health. Now when my cat got like 50 feet away, it still reduced the health. Doesnt make sense! I tried all kind of things with your file, but nothing worked. What was insteresting is that i made a cube with the “monster” property and got rid of the lizard’s property the chicken died when I ran into the cube, not got near it. It is either somehting in the mesh, or i have absolutly no clue. try re-making your lizard from scratch and see if that works. If not, i have no clue.

Sorry about the long post and only one suggestion :stuck_out_tongue: .

tell me if my idea works.


PS, the collision works in my cat game because i made it so that when the mouse collides with my character it sends a message which takes down the players health. You may want to try that.

(gargola) #6

nothing!!! nothing works! Pooba: i tried your idea,but no luck! :frowning: .sorry,i can’t try your cat game right now cause i’m having problems with my internet connection,but i’ll try it later.i don’t know what to do…but i got another question: How i move the bounding sphere and how i change its size like wiseman303 said?

(gargola) #7

Pooba: it’s true…i made a cube with the monster property and it worked correctly!my character died when i touched the cube…how weird! i’ll have to make the enemy again like you said.(damn! he he! :smiley: ) i don’t see what’s wrong with the enemy mesh…thanx for the suggestion. :stuck_out_tongue: i’m going now to try and if that fix the problem,i’ll say it here.see ya! :smiley:

(wiseman303) #8

Does your monster have a near sensor? If so, then that’s the problem.
When an object enters the area covered by a near sensor, it sends a puls to any collision sensors the object has. It’s a bug in blender that I ran into when making my Robo-Gladiators game. I got around it by using touch sensors, but pooba’s method probably works just as well.

(Pooba) #9

Wow, i didn’t know that. When i deleted the near sensor used in gargola’s game it worked fine! Thanx for the info Wiseman!

(gargola) #10

the near sensor of the enemy? if i remove the near sensor, then,how i’m going to make the enemy chase my player?..i tried removing the near sensor,then it only works when i touch the enemy on the sides…it mostly collides with the player with the face(front).now more problems! :frowning:

ps: the near sensor i used is not for collision,i used it to make the enemy chase my player.

(saluk) #11

Just add a cube with the property monster, and parent it to the monster. When your character has a collision with the cube, then the collision will be registered right. It’s probably good practice to do collisions this way anyhow, so that you only have the six sides of the cube registered for collisions, instead of who knows how many faces on the object. Might help with performance.

I’m glad you guys figured this problem out, I was having this problem a while ago as well and never did figure it out.

(gargola) #12

Saluk: i tried that already.the problem here is the near sensor,when i removed it, it worked fine…now i can’t make the enemy chase my player.this is a weird problem,cause i got near sensors on my Flash Ninja game and everything works fine!..

(wiseman303) #13

make sure to delete the monster property from your monster, and just have it on the cube.

(gargola) #14

WISE: did that and it doesn’t work either…guys,i’ll post the file later(still having problems with my internet connection)so you can see it for yourself.maybe i’ll quit. :frowning:

(SeaCigar) #15

Man, thats too bad… :frowning: I suppose I will try to help, a. because I may run into the same problem later in my game, and b. because people helped me right when I was ready to give up. I hadn’t tried before now because I thought the problem would have been solved (you’ve had more capable people than me helping you so far). anyway, I’ll download your file, and see what I can do.

(wiseman303) #16

Fixed it.

OK, here’s what I did, step-by-step.
1, added a cube and stretched it to fit over the monster.
2, added the property ‘monster’ to the cube.
3, parented the cube to the monster.
4, deleted the ‘monster’ property from the monster.
5, selected the player, and changed the touch sensor to a collision sensor, detecting the property ‘monster’.
6, adjusted the shape of the cube so that the player would register a collision at the right time.
7, selected the cube and entered face select mode, there I set all faces to invisible.

I think that covers everything.

gargola, try the file now and see if that’s what you wanted.

(gargola) #17

Wise: thank you so much…but i fixed the problem…i deleted the enemy mesh and made another enemy and now the game works fine.thanx really i appreciate it.i’ll take a look at it anyway to see what you have is my new version: thanx again Wise. :smiley:

(SeaCigar) #18

:o Dang! just when I think I would be of some use. :stuck_out_tongue: