x


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?

more ▼

asked Oct 12 '11 at 01:00 PM

Catlard gravatar image

Catlard
527 47 57 62

if you've got a true sidescroller, with no 3D effect at all, why not move the platform back a bit?

Oct 12 '11 at 01:19 PM Kacer
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Oct 12 '11 at 01:50 PM

wccrawford gravatar image

wccrawford
91 1 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1682
x38
x12

asked: Oct 12 '11 at 01:00 PM

Seen: 1077 times

Last Updated: Oct 12 '11 at 01:50 PM