- Home /
Ignore Collision Layer,
Okay, here is my scenario:
2D game and trying to move up and down ladders. The ladders are connected to platforms but I want to be able to move through the platform when climbing and when not climbing actually be able to walk on the platforms. However, I can't just disable the platform because then NPCs on the platforms would fall through. Is there a way to tell the platform to ignore the player collision when the player is climbing, and accept the collision when not climbing? Thanks in advance, I'm hoping that I just overlooked something. Thanks!,
Answer by jaised · Feb 28, 2012 at 09:32 PM
For those who need an answer in the future, I finally figured it out. By using:
var layerOneToIgnore : int;
var layerTwoToIgnore : int;
var ignore : boolean;
if(_player.isClimbing) {
Physics.IgnoreLayerCollision(layerOneToIgnore, layerTwoToIgnore, ignore);
}
All I had to do was apply a layer to the platform and a layer to the player, and when the player is climbing, trigger the layer ignorance depending on a true/false state. Works like a champ. Turns out, I just over-looked stuff =D
Your answer
Follow this Question
Related Questions
How do i get some objects to ignore collision with a specific object? 10 Answers
Ignore awake function call to destroy game object if character enters trigger 1 Answer
How to ignore a raycast collision with a particular object? 4 Answers
Particles: Avoid collision with parent's collider 0 Answers
IgnoreCollision with Particle System 1 Answer