- Home /
Strange collision happenings...
Just had a weird new symptom begin to pop up and can't figure out why it's happening. It only recently started experiencing it and I can't think of any change I've made that would affect it...
I have gameobjects with rigidbodies moving via AddForce(), lets call them 'fireballs'
I have gameobjects with char controllers moving via Move(), lets call them 'enemies'
The 'fireballs' are supposed to OnCollisionEnter() with the enemies and explode and do damage then destroy themselves.
Instead, the fireballs push the enemies until the enemies can no longer move, THEN OnCollisionEnter is called and the expected behaviour happens.
When the enemies are standing still, everything occurs as expected. It is only when they are moving that I experience this behaviour.
Any ideas what could cause this? thanks guys. I've had it up to here with colliders and their nuances lately... I'm holding my hand at brow level.
Furthermore.... I've just thought of a solution as I'm typing this... I'm going to make the sphere collider attached to the fireball "isTrigger = true," however, that doesn't explain why the Collider doesn't detect the Collision until it has pushed the enemy as far as it can go... so i'm very curious and would still like to ask this question anyway.
thanks!
I'm pretty sure collision event only fire when a rigid body is attached to the enemies.
Answer by morbidcamel · Jan 12, 2014 at 11:09 AM
for a collision event to fire I'm pretty sure you need to attach a rigid body to the enemy
nope, it was working before just fine, and as far as components on game objects, nothing changed.
If your fireballs move I a straight line you can do a Raycast to see if it's going to hit the target. The advantage of that is you can spawn a damage prefab before it hits that target. I don't know why it used to work differently but It sounds like maybe it's just doing what it is told.. Have you checked the mass of the rigidbodies. If your fireballs have a huge mass surely it will react like his..
Your answer
Follow this Question
Related Questions
CharacterController and Normal rigidbody Box Collider Collision issues 0 Answers
Two Character Controllers Colliding... 0 Answers
Does OnCollisionEnter only get called when the scripted object initiates the collision? 4 Answers
Can't use Rigidbody or Character Controller 0 Answers
Stop objects from going through each other with rigidbodies 1 Answer