using UnityEngine; public class OnCollisionAddForce : MonoBehaviour { public float forceMultiplier = 1f; // Adjust the force applied to the object void OnCollisionEnter(Collision collision) { // Check if the colliding object is the character controller if (collision.gameObject.CompareTag("PlayerExtraCollision")) // Ensure the player has the "Player" tag { // Calculate the force direction (away from the collision point) Vector3 forceDirection = collision.contacts[0].normal; // Normal vector points outward Rigidbody rb = GetComponent(); if (rb != null) { rb.AddForce(forceDirection * forceMultiplier, ForceMode.Impulse); } } } }