playMaker

Author Topic: How do you make one unit have different colliders?  (Read 2757 times)

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
How do you make one unit have different colliders?
« on: May 29, 2012, 06:14:40 PM »
I want a unit to have multiple colliders, and only 1 of the mI want to actually interact with the physics, the rest are just for bounds checking like hitboxes.  How would I accomplish this without the children colldiers causing issues with the rigidbody physics?
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: How do you make one unit have different colliders?
« Reply #1 on: May 30, 2012, 01:23:02 AM »
I use at least 2-4 colliders on my player object, so maybe my method will help you.

On my player object I usually have the Character Controller, which has it's own Capsule Collider, and you can use that for Character Controller collisions and regular collisions.  I use this for my main interaction between the player and the world.

You can also add extra colliders to the player object as long as they're not the same type as one it already possesses (cannot have two Sphere colliders, but you can have a Sphere and a Capsule collider together, etc).  I usually put at least one extra collider on my player object directly for monitoring as a trigger or registering all objects that come within a certain distance of the player (for me, this collider is usually scaled up quite large).

In the above example I don't have to worry about the second collider interacting with rigidbody physics because it's marked as a Trigger.  However even if it weren't, I wouldn't have an issue because the second collider is also already scaled up quite large, and completely encompasses any other physics on the player object.

The third method I use is to create an empty game object that only has a collider on it, and I parent it under the player object.  Then, if you don't want it to interfere with any other physics (or only a certain type), you can simply put it in a separate layer, and set up your layer collision properties (Edit -> Project Settings -> Physics) so it does not interact with any other layers that you don't want it to.

I was going to mention something else but I forgot what... . At least this should give you an idea of the right direction.  I hope it helps some!  Let me know if it doesn't work for you and I'll see if I can help you in some other way.
« Last Edit: May 30, 2012, 12:08:00 PM by artician »

iPetProjectDev

  • Playmaker Newbie
  • *
  • Posts: 23
Re: How do you make one unit have different colliders?
« Reply #2 on: June 02, 2012, 06:18:42 AM »
Thanks for this info. I am getting tired of having to google things endlessly and was wondering if there was a way to get other triggers and collider into a CC setup as I saw alot of consternation and hair pulling about this issue on googling. The worst is googling and running into alot of "Thanks, I figured it out." and no frikkin' answer on how they did it.

Thx
Randy