I've been following Brackey's tutorial on this, see the excerpt from my code below. In his tutorial it only teaches "transform.Translate", how do I use this gamepad input system tool to add forces to the character to make them move instead? So I can have jump physics, and when they're in space they'll keep the momentum.
{
NewControls controls;
Vector2 move;
Vector2 rotate;
private void Awake()
{
controls = new NewControls();
controls.Gameplay.Jump.performed += ctx => Jump();
controls.Gameplay.Walk.performed += ctx => move = ctx.ReadValue<Vector2>();
controls.Gameplay.Walk.canceled += ctx => move = Vector2.zero;
controls.Gameplay.Rotate.performed += ctx => rotate = ctx.ReadValue<Vector2>();
controls.Gameplay.Rotate.canceled += ctx => rotate = Vector2.zero;
}
private void Update()
{
Vector2 m = new Vector2(move.y, move.x) * Time.deltaTime;
transform.Translate(m, Space.Self);**
Vector2 r = new Vector2(rotate.y, rotate.x) * 100f * Time.deltaTime;
transform.Rotate(r, Space.Self);
}
}
To move with rigidbody controls, you have to use things like “forward” or “left” but I want one joystick to control the forward, backwards, and side to side movements. I don’t know how to use the joystick input for moving in all those directions. The tutorials have them as separate arrow keys
does anyone have some sample code, or a tutorial to point me to, or just some explanation? it would be much appreciated.