Movement Script Causes GameObject To Fly

This code is for controlling a GameObject

I want to have continuous collision detection which won’t work with MovePosition so I tried changing it other options but those are making the GameObject Fly

Why does converting this line

Rb.MovePosition(transform.position + GameObjectCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime);

to this

Rb.velocity += GameObjectCamera.transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

or this

Rb.AddForce(-transform.right * CurrentSpeed * Time.fixedDeltaTime, ForceMode.VelocityChange);

makes the GameObject fly?

Also, this works but the GameObject still flies

Rb.AddForce((-transform.right * CurrentSpeed * Time.fixedDeltaTime) - Rb.velocity, ForceMode.VelocityChange);

Note that I can’t directly set the velocity because other forces are overwritten then

Hello.
When moving via TRansform, you are like a “god”. It will move what you say, independent of masses, gravities, other objects…

You changed from a non-physics movement, to a physiscs movement. I mean, you are applying a force, you are not “forcing” the object to move.

Unsing rigidbdy to move, its ok if you want that physics do its job. I don’t know what your movement is for… you just say a GameObject…

If the problem where the collision detection, you can still move the object via transform using transform.translate, wich will move more “continious”, and just need to mark the collision detection to ContinuousDynamic in inspector.



Bye!!

Hello,
So you might only need to delete the “GameObjectCamera” So it would be

Rb.velocity += transform.forward * CurrentSpeed * Time.fixedDeltaTime; 

Also just a question: where is the “GameObjectCamera” positioned cause this can also cause the problem?
Hope this helps.