with this script how can i make it so that the objects scale shrinks at the same rate as the mass shrinks, so the scale will reach 0 at the same time the mass does?
float scale;
private Rigidbody rb;
private Rigidbody otherRB;
Vector3 temp;
// Use this for initialization
void Start()
{
rb = GetComponent<Rigidbody>();
scale = .01f;//(rb.mass - otherRB.mass) / 300;
}
void OnTriggerStay(Collider other)
{
otherRB = other.GetComponent<Rigidbody>();
if (other.gameObject.tag == "Death")
{
temp = transform.localScale;
temp.x -= scale;
temp.y -= scale;
temp.z -= scale;
rb.mass -= (rb.mass - otherRB.mass)/300;
transform.localScale = temp;
}
}