Please tell me what I am doing wrong, I have a simple scene with a floor, a static camera and a sphere with a Rigidbody, the movement is horrible, I have tried all the solutions I could find, interpolate, modify the FixedTimeStep, etc, etc, etc.
I understand that FixedUpdate runs by default 50 times per second, everyone explains it, but no one says how to move an object with physics smoothly, they just come to the conclusion: "Now it does not tremble so much ... it's fine for me ... ". It can not be that hard...
using UnityEngine;
[RequireComponent (typeof(Rigidbody) )]
public class PlayerController : MonoBehaviour
{
Rigidbody rb;
Vector3 movement;
public float SpeedMultiplier = 5f;
private void Awake()
{
rb = GetComponent();
}
void Update()
{
movement.x = Input.GetAxis("Horizontal");
movement.z = Input.GetAxis("Vertical");
}
private void FixedUpdate()
{
MoveWithForce();
}
private void MoveWithForce()
{
rb.AddForce(movement * SpeedMultiplier);
}
↧