s key works (goes backward)

This commit is contained in:
logzinga 2023-02-10 11:02:14 +11:00
parent f851302a1f
commit 3a083bd291
2 changed files with 9 additions and 1 deletions

View File

@ -519,7 +519,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 715590524}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -26.47}
m_LocalPosition: {x: -15.88, y: 1, z: -16.65}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -541,6 +541,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
rb: {fileID: 715590525}
forwardForce: 1000
sidewaysForce: 1000
--- !u!1 &811151746
GameObject:
m_ObjectHideFlags: 0

View File

@ -9,6 +9,9 @@ public class PlayerMovement : MonoBehaviour
public float forwardForce = 1000f;
public float sidewaysForce = 1000f;
// Start is called before the first frame update
void Start()
{
@ -21,5 +24,9 @@ public class PlayerMovement : MonoBehaviour
if (Input.GetKey("w")) {
rb.AddForce(forwardForce * Time.deltaTime, 0, 0);
}
if (Input.GetKey ("s")) {
rb.AddForce(-forwardForce * Time.deltaTime, 0, 0);
}
}
}