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

calculate force on impact

$
0
0
im trying to calculate the force an object gets hit by when i swing a bat at it or throw it against the wall im not sure why this dosent work as it has worked in the past for me void OnCollisionEnter(Collision collision) { float otherMass; if (collision.rigidbody) { otherMass = collision.rigidbody.mass; } else{ otherMass = 1000; float force = collision.relativeVelocity * otherMass; if (force > 1){ print("force = "+force); } } } i never used to get this error Cannot implicitly convert type `UnityEngine.Vector3' to `float' but now i do and its pointing to the float force part of the script

Viewing all articles
Browse latest Browse all 157

Trending Articles



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