I made a script to move the player, my intention is to made a slippery movement like in ice, it used to work, but one day I opened the editor and didn't work for some reason, the only fixes i've been able to discover created an awful movement.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
Rigidbody rb;
[SerializeField] float speed;
[SerializeField] Vector2 rawMovement;
[SerializeField] Vector3 movement;
[SerializeField] Vector3 DEBUG_velocity;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
rawMovement = new Vector2(InputManager.Instace.GetNormalMovement().x, InputManager.Instace.GetNormalMovement().y);
movement = new Vector3(rawMovement.x * speed, 0, rawMovement.y * speed);
rb.AddForce(movement);
DEBUG_velocity = rb.velocity;
}
}
Images: Rigidbody component Player script
Video showing up what is happening: Video
My objective was to make a slippery movement, like ice, I tried changing the force type, the speed amaount, tweaking the variables but none worked, my only results were a blocky movement
EDIT: I tried moving the AddForce() to FixedUpdate() but didn't work
Ok, I managed to find the error, I had to ask in unity's discord. Turns out it was the object called "CameraLimits" it had a box collider and the player was inside it.