- Home /
Without affecting Velocity, what is the best method to apply direction to an object moving with forces?
I've been looking for a solution to shift a moving rigidbody to the direction that it's physically facing while powering with forces. The problem is, much of what I've encountered in code examples modify velocity - but that cancels out gravity, which is a major part. The code below is what I have thus far, which just changes the orientation but not direction:
roll = Input.GetAxis("Horizontal") * (Time.deltaTime * RotationSpeed);
AddRotation = new Vector3(0, 0, roll);
rgBody.rotation *= Quaternion.Euler(AddRotation);
This only affects the gameObject, not the direction it's travelling in. The initial forces provided are one-off, and the gameObject travels in a ballistic arc after launch.
What can I do to add the rotation to the movement without using velocity, in order to alter the direction of the arc?
Answer by FogCZ · Oct 13, 2020 at 04:04 PM
Well this is very old Topic, to anyone else still wondering you could definitely creat a parent object that stay still and ad child object that is rotating, or you can only rotate the mesh