Game Development Reference
In-Depth Information
1. using UnityEngine;
2. using System.Collections; 3.
4. public class PhysicsCharacter : MonoBehaviour { 5.
6.
//maximum jump height in meters
7.
public float jumpHeight = 2;
8.
9.
//Horizontal movement speed
10.
public float movementSpeed = 8;
11.
12.
//Position of the character's feet
13.
public Transform feet;
14.
15.
//Input flags
16.
bool walkForward, walkBackwards,
17.
strafeRight,
strafeLeft,
jump;
18.
19.
void Start () { 20.
21.
}
22.
23.
public void WalkForward(){
24.
walkForward = true;
25.
walkBackwards = false;
26.
}
27.
28.
public void WalkBackwards(){
29.
walkBackwards = true;
30.
walkForward = false;
31.
}
32.
33.
public void StrafeRight(){
34.
strafeRight = true;
35.
strafeLeft = false;
36.
}
37.
Search WWH ::




Custom Search