track limits
This commit is contained in:
1 parent
e6117313ad
commit
db2ab578cc
3 files changed
+13629
-142
No files matched your search
+13609
-127
File diff suppressed because it is too large.
Load diff
+16
-14
@@ -17,8 +17,8 @@ public class ShipControls : MonoBehaviour {
|
|||||||
ForceMode m_forceMode;
|
ForceMode m_forceMode;
|
||||||
|
|
||||||
// Camera Controls
|
// Camera Controls
|
||||||
float m_mouseH = 0.5f;
|
float m_mouseH = 1.0f;
|
||||||
float m_mouseV = 0.5f;
|
float m_mouseV = 1.0f;
|
||||||
float m_camYaw = 0.0f;
|
float m_camYaw = 0.0f;
|
||||||
float m_camPitch = 0.0f;
|
float m_camPitch = 0.0f;
|
||||||
|
|
||||||
@@ -67,12 +67,14 @@ public class ShipControls : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector3 getThrust() {
|
Vector3 getThrust() {
|
||||||
// thrust
|
// thrust in the direction of the camera
|
||||||
if (Input.GetMouseButton(0))
|
if (Input.GetMouseButton(0))
|
||||||
|
// transform from the camera's forward vector into world space
|
||||||
return m_camera.transform.TransformDirection(Vector3.forward) * m_thrustMag;
|
return m_camera.transform.TransformDirection(Vector3.forward) * m_thrustMag;
|
||||||
|
|
||||||
// brake
|
// brake just decelerates the ship against the direction it is moving
|
||||||
if (Input.GetMouseButton(1)) {
|
if (Input.GetMouseButton(1)) {
|
||||||
|
// the velocity is already in world space so we just invert it
|
||||||
return m_rigidBody.velocity.normalized * -1f * m_thrustMag;
|
return m_rigidBody.velocity.normalized * -1f * m_thrustMag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,8 +82,8 @@ public class ShipControls : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2D strafing
|
// 2D strafing
|
||||||
// TODO add multiplier
|
// we combine all the vectors so you can move in 2 dimensions at once
|
||||||
// combine
|
// thrust is added as a relative force so we don't need to convert to worldspace
|
||||||
Vector3 getStrafe() {
|
Vector3 getStrafe() {
|
||||||
Vector3 strafe = new Vector3(0.0f, 0.0f, 0.0f);
|
Vector3 strafe = new Vector3(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
@@ -105,14 +107,14 @@ public class ShipControls : MonoBehaviour {
|
|||||||
if (Input.GetKey(KeyCode.Space))
|
if (Input.GetKey(KeyCode.Space))
|
||||||
Respawn();
|
Respawn();
|
||||||
|
|
||||||
if (Input.GetKey(KeyCode.Alpha1))
|
// if (Input.GetKey(KeyCode.Alpha1))
|
||||||
m_forceMode = ForceMode.Acceleration;
|
// m_forceMode = ForceMode.Acceleration;
|
||||||
if (Input.GetKey(KeyCode.Alpha2))
|
// if (Input.GetKey(KeyCode.Alpha2))
|
||||||
m_forceMode = ForceMode.Impulse;
|
// m_forceMode = ForceMode.Impulse;
|
||||||
if (Input.GetKey(KeyCode.Alpha3))
|
// if (Input.GetKey(KeyCode.Alpha3))
|
||||||
m_forceMode = ForceMode.Force;
|
// m_forceMode = ForceMode.Force;
|
||||||
if (Input.GetKey(KeyCode.Alpha4))
|
// if (Input.GetKey(KeyCode.Alpha4))
|
||||||
m_forceMode = ForceMode.VelocityChange;
|
// m_forceMode = ForceMode.VelocityChange;
|
||||||
|
|
||||||
if (Input.GetKey(KeyCode.F10))
|
if (Input.GetKey(KeyCode.F10))
|
||||||
Application.Quit();
|
Application.Quit();
|
||||||
|
|||||||
Executable → Regular
+4
-1
@@ -4,5 +4,8 @@
|
|||||||
EditorBuildSettings:
|
EditorBuildSettings:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes: []
|
m_Scenes:
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/SampleScene.unity
|
||||||
|
guid: 9fc0d4010bbf28b4594072e72b8655ab
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
Reference in new issue
Block a user