- Home /
Moving through walls
Im working on a game where you play as both an angel and a demon. They each have their own set of powers. The demons power consit of destroying things and phasing through walls. Im not the strongest programmer. This game is completely in First Person. So Im wondering how I would program the phasing through walls.
almost certainly you need to learn about the layer-based collision system. it's essential for all non-trivial development in Unity, so go for it! and it is not program$$anonymous$$g-oriented, even, you just click boxes. Enjoy
Answer by DaveA · Oct 30, 2012 at 06:53 PM
Assuming you have colliders and rigidbodies on the players and the walls, just disable the rigidbody collision: http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody-detectCollisions.html (untested)
Answer by CubePhysics · Oct 30, 2012 at 08:44 PM
you could create new scenes which you play as the angel and demon. For the demon scenes just get rid of the box collider for walls you want the player to go through
Answer by Noah-1 · Oct 30, 2012 at 07:20 PM
I would create a Boolean, if it equals to true its an angel, else its a demon, if your Boolean equals to true (angel mode), then you just disable the wall colliders.
//just a simple example
var playerMode: boolean;
var wallCollider: Collider;
function Update(){
if(playerMode == true){ //if angel
wallCollider.enabled = false; //disable wall
}else{wallCollider.enabled = true;}//if demon, enable them
}
Hope it helps, good luck.
Answer by XienDev · Oct 31, 2012 at 07:15 AM
Hope this help Set wall collision layer as wall, flour - flour, and demon - demon.
if (demon.CanWalkThroughtWalls)
Physics.IgnoreCollision(demon.collider, wall.collider);
else
Physics.IgnoreCollision(demon.collider, wall.collider, false);
Or something like this. Don't remember now
Your answer
Follow this Question
Related Questions
Patching glitches 1 Answer
How to position a gun on a FPS Charater 1 Answer
How to create wall at runtime? 3 Answers
moving gun in first person shooter while walking 8 Answers
RigidbodyFPSWalker climbing walls 2 Answers