I’m making a game where the player controls an object and has to push other objects, but I’m having trouble making the object being pushed depend on the player objects speed.
This is what I’m using now.
void OnCollisionEnter(Collision c) { if (c.gameObject.tag == "Pushable") { Vector3 dir = c.contacts[0].point - transform.position; float force = 2000; c.gameObject.GetComponent().AddForce(dir * force); } }
The problem is it pushes with the same force no matter how fast the players object is moving.