Hello,
I need to Move slowly a RigidBody with MovePosition up and down.
This object that I need to move is child of another object just to let you know it.
I am close but it doesn’t work. It’s 3 days I stucked on this, please help!!
I tried something like this but doesn’t work.
void FixedUpdate() {
float newY = Mathf.Sin(Time.time);
Vector3 direction = ((new Vector3(0, Mathf.Abs(newY)* height,1)) -transform.localPosition).normalized;
r.MovePosition(transform.position + direction * movementSpeed * Time.deltaTime);
}
Could you write a working code for make this work please?