Quantcast
Channel: Questions in topic: "addforce"
Viewing all articles
Browse latest Browse all 1264

Constant force motion: s = s0 + v0 * t + a0 * t * t. Why?

$
0
0
I have a **rigid body** with with an absolute **constant force** (100, 0, 0). I am trying to predict the next position of the rigid body. The mass is equal to 1 so the constant force and the acceleration are the same. According to [Wikipedia][1] the end displacement **s** should be s = s0 + v0 * t + a0 * t * t / 2; where **s0**, **v0** and **a0** are the initial displacement, velocity and acceleration. And **t** is the time interval (Time.fixedDeltaTime in Unity). For some reason the correct displacement formula in Unity is s = s0 + v0 * t + a0 * t * t; I am trying to figure out **why**. I've tested this using a simple script with a FixedUpdate() method which logs the current position to the console. Vector2 s0 = transform.position; Vector2 v0 = rigidbody.velocity; Vector2 a0 = constantForce.force; float dt = Time.fixedDeltaTime; Vector2 dsV = dt * v0; Vector2 dsA = 1.0f * dt * dt * a0; Vector2 s1 = s0 + dsV + dsA; Debug.Log("DSIP X: " + s0.x + " + " + dsV.x + " + " + dsA.x + " = " + s1.x + " @ " + Time.time); [1]: https://en.wikipedia.org/wiki/Acceleration#Uniform_acceleration

Viewing all articles
Browse latest Browse all 1264

Trending Articles



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