Postingan

Menampilkan postingan dari Juni, 2022

Free Code

PlayerMovement: 2d Code : public class movement2D : MonoBehaviour { Rigidbody2D body; float horizontal; float vertical; public float runSpeed = 10.0f; // Start is called before the first frame update void Start() { body = GetComponent (); } // Update is called once per frame void Update() { horizontal = Input.GetAxisRaw("Horizontal"); vertical = Input.GetAxisRaw("Vertical"); } private void FixedUpdate() { body.velocity = new Vector2(horizontal * runSpeed, vertical * runSpeed); 3d Code: public class Example : MonoBehaviour { private CharacterController controller; private Vector3 playerVelocity; private bool groundedPlayer; private float playerSpeed = 2.0f; private float jumpHeight = 1.0f; private float gravityValue = -9.81f; private void Start() { controller = gameObject.AddComponent (); } voi...