- Home /
Forces on my rigidbody are really slow
Hello. In my script, I used maximum force as is possible. If i added more, visual studio told, it cant be used. But it moved so slow, I couldnt almost see it. My scrpit looks like this:
public class RbMovement : MonoBehaviour { Rigidbody rb; Vector3 forward; public float speed = 40f;
void Start()
{
rb = this.GetComponent<Rigidbody>();
}
void Update()
{
forward = new Vector3(Input.GetAxis("Vertical") * speed * Time.deltaTime * 100000, 0, 0);
}
void FixedUpdateUpdate()
{
rb.MovePosition(this.transform.position + forward);
}
}
(this isnt the maximum I was talking about)
Does anyone know, what is wrong here?
What is "speed" value? You can try using AddForce, an see what happens.
void Update()
{
forward = new Vector3(Input.GetAxis("Vertical") * speed * 100000, 0, 0);
}
void FixedUpdateUpdate()
{
rb.AddForce(forward, Force$$anonymous$$ode.VelocityChange);
}
I tried it as well. It just cant move faster
Answer by JackhammerGaming · Apr 14, 2020 at 07:30 AM
well you have are multiplying speed with Time.delta.Time so if you want to increase change the code to something like
void Start() { rb = this.GetComponent<Rigidbody>(); } void Update() { forward = new Vector3(Input.GetAxis("Vertical") * speed * 100000, 0, 0); } void FixedUpdateUpdate() { rb.MovePosition(this.transform.position + forward); }
that will move charcter way to fast but that can be adjusted by lowering down speed variable.
Answer by qobion · Apr 14, 2020 at 08:20 AM
forward = transform.forward * Input.GetAxis("Vertical") * speed * Time.deltaTime;
Your answer
Follow this Question
Related Questions
slow addforce 1 Answer
Rigidbody y velocity is stuck on 0, gravity is not turned off. 2 Answers
Clone of Coin Doer Game.Need Help 1 Answer
all Rigid body's slow down and speed up 1 Answer
Physics Material slow down the game. 2 Answers