0
\$\begingroup\$

I am creating a 2D game and the player object has a rigidbody2D attached to it. The game works fine until the player collides with a power up. The rigidbody physics get all messed up. So I was wondering is there a way so that rigidbody will only act on enemies and be disabled for power ups?

\$\endgroup\$
  • \$\begingroup\$ Please be more specific than "all messed up". \$\endgroup\$ – jhocking Jul 14 '14 at 9:46
0
\$\begingroup\$

Yes, you can use layers, making the player and the power up different layers. This means they won't collide however, so it'll be difficult to detect when the player picks up the power up.

Alternatively, you can make the power ups have a collider, but set it to trigger. This means the power ups will not collide with other objects but rather only cause the OnTriggerEnter and OnTriggerExit events to fire when something collides with the power up.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.