Quantcast
Channel: Questions in topic: "mass"
Viewing all articles
Browse latest Browse all 157

shrinking mass and scale

$
0
0
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(); scale = .01f;//(rb.mass - otherRB.mass) / 300; } void OnTriggerStay(Collider other) { otherRB = other.GetComponent(); 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; } }

Viewing all articles
Browse latest Browse all 157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>