playMaker

Author Topic: Rigidbody Collisions  (Read 2786 times)

Avascar

  • Playmaker Newbie
  • *
  • Posts: 45
Rigidbody Collisions
« on: December 16, 2012, 07:56:17 AM »
Hey everybody, so apperently I've been having issues with collision detections. I created, let's say, a spike. If the player touches the spike then the player respawns. So I added a rigidbody to the spike, and one too for the player. They work pretty well, it's just that I'm having great difficulty with collision detection in the script. Any help? I don't want to use triggers on this by the way.

EDIT: @The picture below: The first state (Trigger) doesn't have any events, The second state (Respawn) does, but it's unrelated to the collision problem I believe.

Uttpd

  • Junior Playmaker
  • **
  • Posts: 70
Re: Rigidbody Collisions
« Reply #1 on: December 17, 2012, 07:47:39 AM »
Collisions in unity depend on various characteristics.
Maybe you already saw it:

http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html

scroll to the end of the page thereĀ“s a handy chart there. Recheck your rig against it.




Avascar

  • Playmaker Newbie
  • *
  • Posts: 45
Re: Rigidbody Collisions
« Reply #2 on: December 28, 2012, 08:05:14 AM »
Alright it works fine, however it kills me whenever it touches the floor. How do I make it so it only triggers an event if it collides with a specific game object?

EDIT: So I've been experimenting, and I made another game object (that kills you with Collision Enter) and made it move in the air (so it doesn't touch anything). However, I've been having another issue, the collision doesn't happen unless I somehow move "inside it", not touching it.
« Last Edit: December 28, 2012, 08:45:27 AM by Avascar »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rigidbody Collisions
« Reply #3 on: January 01, 2013, 08:10:28 AM »
Hi,

 When you want more options for detection collisions, you should use the "Collision Event" action:

https://hutonggames.fogbugz.com/default.asp?W30

this action allows you to filter by tag.

the other option, is to check the hit gameObject manually, either by checking its name, tag, layer or else. you can use the action "Get Collision info" to do that.
https://hutonggames.fogbugz.com/default.asp?W369


one last option, is Unity based: the physics matix, where you can stipulate how layers can collide or not with each others, This is very powerful as well, as you can simply void out any physics gameObject you don't want for some collisions. not this is an advanced feature, so make sure you fully understand what this means:
http://docs.unity3d.com/Documentation/Components/class-PhysicsManager.html

bye,

 Jean