First, my code:
newPosition = gravity.ActualGravity(_movementVector, actionState.isAi); // The original Movement Vector I was using in transform.Translate
float newX = Mathf.SmoothDamp(parentObjectTransform.position.x, newPosition.x, ref xVelocity, smoothTime); // All the ref variables are set to 0
float newY = Mathf.SmoothDamp(parentObjectTransform.position.y, newPosition.y, ref yVelocity, smoothTime);
float newZ = Mathf.SmoothDamp(parentObjectTransform.position.z, newPosition.z, ref zVelocity, smoothTime);
Vector3 newMovementVector = new Vector3(newX, newY, newZ);
parentObjectTransform.Translate(newMovementVector);
This method is run when the unit is grounded.
The second he lands he gets dragged through the terrain.
I believe that I followed this well, but for some reason it’s not working.
Lastly, gravity.ActualGravity() applies movement speed to the vector before translating the GameObject.
- The purpose of this is to fix a Vector3 Translation so that it doesn’t bounce as much.
Thanks for any help provided.