Collision Problem Fixed

Posted by (twitter: @pkenneydev)
April 18th, 2015 3:03 am

I guess in Unity2D you cannot have two objects that both check OnCollision colliding with each other, or it’s a coin toss whether they’ll both get the OnCollision event actually called.  Or maybe it’s just one of them?

Either way I cut the OnCollision from the player’s mirror shield and replaced it with a call from the projectile’s OnCollision so there’s just one function.  Now when projectiles hit it they consistently flash and tween.

LD32-CollisionFixed.gif

(Wow everything still looks jerky at that frame rate!  Didn’t want to load a huge gif though)

 


One Response to “Collision Problem Fixed”

  1. neontarkus says:

    You might try using an OnTriggerEnter in a trigger field near the object, depending on what you need it for. Or perhaps one object can SendMessage to the other when it collides…

    Either way, looking good!

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]