UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"can you make a wasd movement for unity"
Yes, here's a simple script for WASD movement in Unity: ```csharp using UnityEngine; public class WASDMovement : MonoBehaviour { public float moveSpeed = 5f; private Rigidbody rb; private void Start() { rb = GetComponent<Rigidbody>(); } private void Update() { float horizontal = Input.GetAxis("Horizontal"); float vertical = Input.GetAxis("Vertical"); Vector3 movement = new Vector3(horizontal, 0, vertical) * moveSpeed * Time.deltaTime; rb.MovePosition(transform.position + movement); } } ``` Attach this script to the GameObject you want to move, and make sure it has a Rigidbody component. You can adjust the moveSpeed variable to change the movement speed.