inspector
private void Update()
{
if (!grabTransform) return;
Vector3 newPosition = Vector3.Lerp(transform.position, grabTransform.position, Time.deltaTime * 20f);
rigidbody.MovePosition(newPosition);
Quaternion newRotation = Quaternion.Lerp(transform.rotation, grabTransform.rotation, Time.deltaTime * 20f);
rigidbody.MoveRotation(newRotation);
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
}
I’m currently developing a feature that allows picking up and carrying an object. When holding an object, it is implemented to follow the Transform in the front direction of the camera. However, when turning my head towards a wall, the carried object sometimes gets stuck as it intersects with the wall.
I want the object to naturally collide with walls without getting stuck.
When I use Velocity or Addforce, it moves too much, like a spring.
New contributor
나만없어 고양이 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.