Skip to main content
5 of 5
added 12 characters in body

Unity Engine Movement Script Causes Shark To Fly

This code is for controlling a shark

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 Shark Fly

Why does converting this line

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

to this

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

or this

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

makes the Shark fly?

Note: Directly setting the velocity won't work because other forces are acting too