Good evening,
Im curious about how to implement a cover system like in Rainbow six or Metal Gear basically i just want to know how i can lock the player to move along the side of a flat surface. Is it purely in the animation? Like when the player is close to a wall and a button is held down it locks the z axis and plays an animation that looks like the character is edging along the wall? or is there more involved here? just looking for options -Thanks-
Try using a Trigger like OnTriggerStay(col : Collider) {
Cover ();
}
The cover function could play the animation and/or lock the player to the wall.
I think you got the basics figured out. It just switches the animation, and constraints the player to only move along the wall. There is also a different animation played at the edges.
I think the hardest thing to figure out will be how to constrain your players movements to the wall. If all of your walls are at 90 degree angles, this will be easier. But if you have angled and circular walls, this will be more diffucult.
If you do have circular walls and angled walls, i think something you might want to look at is this script
http://www.unifycommunity.com/wiki/index.php?title=Interpolate
specifically how it can let you place bezier curves in the editor view. You might have to place a bezier curve along every edge, and around every corner that your player needs to move up against in order to give you some way to specify how the player should shimmy back and forth on a surface.
Either that, or you going to have to read mesh data and put in some if statements based on the angles of edges to calculate a path to move the player along on the fly. Seems much more diffucult that way.
But if you figure that code out, please share it 8)
Thanks guys i appreciate your input i used the on trigger stay in a previous test for something else so i was familliar with it then i used a yeild to make the controls only respond to left and right input i tried making the animation turn to the side flat against the wall when the player is approching from the front but when approaching with the side of the character towards the wall of course this dosent work is there a way i can also set the rotation to no matter what always face the x axis away from the wall no matter what direction the player is faceing when the conditions for the trigger are meet?
Thanks guys i appreciate your input i used the on trigger stay in a previous test for something else so i was familliar with it then i used a yeild to make the controls only respond to left and right input i tried making the animation turn to the side flat against the wall when the player is approching from the front but when approaching with the side of the character towards the wall of course this dosent work is there a way i can also set the rotation to no matter what always face the x axis away from the wall no matter what direction the player is faceing when the conditions for the trigger are meet?
I would say find the normal of the face of the wall and create a rotation facing towards it using Quaternion.LookRotation then have the character align with the rotation.