I have two characters having a Rigidbody component.
I don’t want to make a character push another when they collide, but make them not to pass through another.
How can I implement this? It is okay not to use Rigidbody.
I tried to check IsKinematic option in Rigidbody, but the result was same.
wewewu
2
You can try reseting the velocity and angular velocity of the objects, which you can achieve by setting IsKinematic to true and to false again:
private void OnCollisionEnter(Collision collision)
{
if (collision.collider.CompareTag(ttag))
{
Rigidbody rb2 = collision.collider.GetComponent<Rigidbody>();
rb.velocity = rb.angularVelocity = rb2.velocity = rb2.angularVelocity = Vector3.zero;
}
}