- Home /
Snapping to walls
Hey everyone I dont know if this is a weird question or not. But I cant find any examples upon it so if anyone knows any examples or a way to do it can you please help me out on it. So basically I am making a gaming in third person or you can say a TPS. Now I want the player to come in contact with a wall and when you press a designated button he will snap to the wall. Either he is hiding behind the wall or he is dodging bullets. Like for instances Splinter Cell or Gears of war. I know theres a trigger involved but I dont know where to start coding this.
Answer by unimechanic · Oct 07, 2014 at 04:11 PM
Detect the wall, and keep the player at certain distance from it. Check this documentation:
http://docs.unity3d.com/ScriptReference/Physics.Raycast.html http://docs.unity3d.com/ScriptReference/RaycastHit.html http://docs.unity3d.com/ScriptReference/Rigidbody.html
Your answer
Follow this Question
Related Questions
Click and Drag with wall snap 0 Answers
Problem with shooting while player moves (third person) 0 Answers
gun holding 1 Answer
Third Person Camera Can See Through Walls! 1 Answer
Make Third Person Character Rotate 1 Answer