- Home /
how to go through platform like bananakong?
hey guys.. i need some help... i have tired to try this function.. i want to make platformer sidescroller game like bananakong.. i can to make character controller.. but really tired to try some function like banana kong. i want to make player can go through to platform when player has jump. like banana kong. when the character under platform, and character jump collider istrigger, but when the character has go through.. collider has without istrigger? like these :
![alt text][1]
i have to try using this code
if (coll.gameObject.tag == "Player" &&!collider2D.isTrigger) collider2D.isTrigger = true;void OnCollisionEnter2D(Collision2D coll) {
}
void OnTriggerEnter2D(Collider2D other){ if(other.gameObject.tag == "canGoThrough" ){ collider2D.isTrigger = false; } } and this my youtube link video for my problem, when i use code like there.. http://youtu.be/TdEaBgj4cTI! i hope someone can help me?? thanks [1]: https://lh3.ggpht.com/FLVFJ7gqfMZyckYLe2AyOMz6RXmlirRhpt27JzSRxpS8viLK0F_eZZSo3t5okRFyARw=h900
Could you try to make the canGoThrough platform's collider2D very thin (or use an edge collider)?
Answer by awest · Jul 21, 2014 at 02:34 PM
I would try checking if the players velocity.y > 0. then make it's collider a trigger. In C#, it could be one line in the players update. although you might only want to check when the player is not grounded.
gameObject.collider2D.isTrigger = (gameObject.rigidbody.velocity.y > 0) ? true : false ;
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Scene Change Collision 2 Answers
Plinko Collision Problem 2 Answers
Missing GameObject and Null do not test the same, but how do I test for missing? 6 Answers