I’m trying to figure out how to calculate the acceleration of a moving object in the scene(no rigid body)… just for the sake of learning something… I’ve already calculated the current velocity, but what I want to know is how to get an initial velocity to compare to the final velocity…Any help would be appreciated
transform.position += new Vector3(speed * Time.deltaTime, 0, 0);
if (Input.GetKey("d"))
speed += 1;
if (Input.GetKey("a"))
speed -= 1;
That question doesn’t make much sense to me. No object moves on it’s own except a rigidbody. All other objects have to be moved by some piece of code. A movement doesn’t have to be accelerated. When you just start moving an object with a certain velocity the acceleration is infinity large at this moment and while it’s moving the acc. is zero.
How do you move your object? Post the relevant code.
Usually it’s the other way: you accelerate an object and as a result the object gains speed. Since you move the object on your, you should have those values already.
edit
Your acceleration is frame dependend since you didn’t multiply it with Time.deltaTime. At the moment it’s (1m/s)/frame. All kind of physics calculations that are more complex (not just linear) should be done in FixedUpdate to have a constant framerate. Quadratic or other high order equatations can’t be fixed that easy with Time.deltaTime.
I’m still not sure what you actually want to know / calculate.