- Home /
How Can I Jump, with my FPS Player
using UnityEngine;
using System.Collections;
public class PlayerControl : MonoBehaviour
{
public float moveSpeed = 10;
public float gravity = 10;
public float jumpHeight = 5;
void Awake()
{
rigidbody.freezeRotation = true;
Screen.lockCursor = true;
}
void FixedUpdate()
{
float h = Input.GetAxis ("Horizontal");
float v = Input.GetAxis ("Vertical");
Vector3 playerMove = transform.right * h + transform.forward * v;
rigidbody.velocity = playerMove * moveSpeed;
}
}
Comment
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
C# Rocket Explode On Impact 1 Answer
Shooting Script -- Bullet won't fire in correct direction First Person View 3D 2 Answers
FPS weapon swap is unresponsive (C#) 0 Answers