Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How to calc force by variables?

$
0
0
Hi, in my application I have a prefab object, which I instantiate and add a relative force. Just like this: var projectile: GameObject; projectile = Instantiate(projectilePrefab, transform.position, transform.rotation); projectile.rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; projectile.rigidbody.AddRelativeForce(new Vector3(0, 0, 2000)); The problem is that I want to let the user set the mass and acceleration, so I can calculate the Force Formula (F = m.a) and add it to the projectile. With the mass I do this, but I'm not sure if it will work... //seting projectile data projectilePrefab.rigidbody.mass = massUser; But how about the acceleration, how can I set it to be calculated? I'm a newbie in Unity and I've checked online and I still can't seem to get it. Any help is appreciated. Thank you for your time.

Viewing all articles
Browse latest Browse all 171066

Latest Images

Trending Articles



Latest Images

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