Question by
BeanBoy29 · Jul 25, 2019 at 05:41 AM ·
gameobjectvelocityaddforce
How to speed up an object with AddForce?
I have a game object that is flying around everywhere. I would like to slow it down, or speed it up with a button or two. I could just do something like:
sphere..AddForce(new Vector3(+1, +1, +1), ForceMode.Impulse);
but that is only effective in one direction. What do I need to do?
Comment
Answer by jintaenate · Jul 25, 2019 at 09:47 AM
Vector3 force;
if (Input.GetKey(KeyCode.Alpha1))
{
// add variable multiplier to field
force = Vector3.one * speedMultiplier;
}
else {
force = Vector3.one;
}
Sphere.AddForce(force, ForceMode.Impulse);
this will work
This dose not work, it makes the Sphere go to the top right corner, but I would like to speed it up no matter which direction it is going
Your answer
Follow this Question
Related Questions
Bullet won't fly forward 0 Answers
need help badly 2 Answers
Trying to add force to an object... is this done correctly? 0 Answers
Change transform.position into addForce or velocity 0 Answers