Hi, I have a FPS character script with movement and jumping. Jumping works good, but the movement could be improved. Here’s the part of the script in question:
if (!Physics.Raycast(transform.position,Vector3(0,0,transform.rotation.z),10)){
var z = Input.GetAxis("Vertical")*speed*Time.deltaTime;
}
The problem is when you’re walking into a wall, the player will have a seizure until finally climbing on top of the wall/floor in front of it.
What I’m trying to do to counter this is check for a collision in front of the character before moving. It doesn’t work however, it still has the same behavior.
I’ve tried a couple other variants of the code, such as using transform.rotation.z instead of Vector3(blah), but it gives be an wrong argument type error(correct name?). Would anyone mind helping me please?
P.S. Call me lazy, but the player has a rigidbody attached to it to handle the gravity and collisions.
P.P.S I’m making this code up from stuff found on the scripting reference, but I don’t entirely understand it all though…