2075 / Unity / 3D / Гравець / FlappyBird
FlappyBird |
- Rigitbody: Freez Rotation x, y ,z
public float jumpForce = 0.1f; public float moveSpeedX = 200.0f; public float moveSpeedY = 0f; public float moveSpeedZ = 0f; Rigidbody rb; void Start() { rb = GetComponent<Rigidbody>(); } void Update() { if (Input.GetButton("Jump")) { rb.AddForce(new Vector3(0f, jumpForce, 0f)); } } void FixedUpdate() { transform.position += new Vector3(moveSpeedX, moveSpeedY, moveSpeedZ); }