- Home /
Climbing above and below a platform?
I'm making a Braid clone (very original, I know) and I want the player to be able to climb up and down a ladder to get to the next platform. The problem is that the player can't climb all the way up or down because he collides with the platform above or beneath him. I could have the istrigger for either the player or the platform enabled and that would solve the problem. But if the player's istrigger is set, then he can't be hit by enemies while climbing, and if the platform's istrigger is set, then the enemy that's patrolling that platform will fall off. I know the platform effector will allow me to climb above the platform, but I don't think it'll let me climb below it. Any ideas?
Answer by DreadKyller · Dec 21, 2017 at 01:50 AM
You'd want to deal with collision layers. You can assign objects to a layer, and have certain layers not collide with each other. Thus you make a primary layer where the player collides with everything, and a secondary layer where the player collides with everything except the platforms.
When the player gets on the ladder, you set the players layer to the secondary one, when the player gets off the ladder you set it back to the primary layer. For more information about collision layers check out here: https://docs.unity3d.com/560/Documentation/Manual/LayerBasedCollision.html
To set an objects layer:
https://docs.unity3d.com/ScriptReference/GameObject-layer.html
https://docs.unity3d.com/ScriptReference/LayerMask.NameToLayer.html
Your answer
Follow this Question
Related Questions
Level design clone of King of Thieves 0 Answers
Softbody physics with 2D sprites 1 Answer
How to blur 2D background sprites? 0 Answers
Timer jitters? SOLVED 0 Answers