How do i do this? Multiple collision bodies!

How do i make my triangle only stand on its matching color, I tried to make 3 different shapes on the triangle body but dont know how to separate the collisions. i couldn’t figure out multiple collision bodies. Any one with a good understanding of this please help thanks! :smiley:

Hi @austin.rau18,

Have you read this tutorial on multi-element bodies?

http://coronalabs.com/blog/2013/01/08/working-with-multi-element-physics-bodies/

Basically, what you need to do is assign the 3 elements to the body (it appears that you already are). Now, depending on the order in which you add them, they will have an internal “index” number. For example, if you add 3 elements, the first will have an index of 1, the second 2, and the third 3.

http://docs.coronalabs.com/guide/physics/collisionDetection/index.html#multielement

With those values, when you handle the collision, just check what that index is and conditionally handle whether the object should stand on its matching color platform (using a pre-collision check).

Hope this helps,

Brent

Thank you  :smiley:

Hi @austin.rau18,

Have you read this tutorial on multi-element bodies?

http://coronalabs.com/blog/2013/01/08/working-with-multi-element-physics-bodies/

Basically, what you need to do is assign the 3 elements to the body (it appears that you already are). Now, depending on the order in which you add them, they will have an internal “index” number. For example, if you add 3 elements, the first will have an index of 1, the second 2, and the third 3.

http://docs.coronalabs.com/guide/physics/collisionDetection/index.html#multielement

With those values, when you handle the collision, just check what that index is and conditionally handle whether the object should stand on its matching color platform (using a pre-collision check).

Hope this helps,

Brent

Thank you  :smiley: