Hello,
I want to trigger a shatter script I made for this glass cup (see image)
The problem I have been having is that I have not found any force detection or unit in the unity physics engine. Here is the code I am currently using:
using UnityEngine;
public class Destroyobj : MonoBehaviour
{
public GameObject destroyedVersion;
private void OnCollisionEnter(Collision collision)
{
float collisionForce = collision.impulse.magnitude / Time.fixedDeltaTime;
if (collisionForce < 100.0F)
{
void OnCollisionEnter()
{
Instantiate(destroyedVersion, transform.position, transform.rotation);
Destroy(this.gameObject);
}
}
}
}
It also shatters if it doesn’t move but if I drop it stays together
Help would be appreciated