- Home /
Pseudocode for jumping through the bottoms of platforms.
So, I'm creating a sidescroller, and I'm having trouble achieving a certain gameplay effect. Basically, I'd like for my character, with a rigidbody collider, to be able to jump to platforms by jumping up through the bottom of them -- a la Sonic the Hedgehog. In the script I'm using that detects collisions between the player and the platforms, I'm using Physics.IgnoreCollision to achieve this effect. The second time the player hits a platform he's allowed to pass through it. But the first time my player character collides with a platform, he's knocked back, and then he falls back through it. Is there a simple way of remedying this situation? I can see two potential solutions. Which one do you think is the winner?
1) I use colliders the same size as the platforms BELOW and ABOVE those platforms to turn physics.IgnoreCollision on and off when my player character hits them.
2) I turn Physics. IgnoreCollision off for all platforms until I am above them--then checking constantly to see which platforms are below me, and making sure those are on.
What do you think?
if you've got a true sidescroller, with no 3D effect at all, why not move the platform back a bit?
Answer by wccrawford · Oct 12, 2011 at 01:50 PM
I would try having a trigger below the platform that turns off the platform's collision, and then when the player leaves the tigger area, turn the collision back on. The trigger should mostly cover the platform, with the exception of the very top.
Your answer
Follow this Question
Related Questions
Missile colliding with Character Controller 3 Answers
Physics.IgnoreCollision not working 0 Answers
How do I find the point of contact on a box collider? 1 Answer
Ignore Collision Between Model and Player 2 Answers
Problems With IgnoreCollision 0 Answers