- Home /
Question by
crasherboom7 · Jul 05, 2021 at 01:05 PM ·
gravityphysics2d
Finding Fx and Fy of an object in Unity
Hey everyone,
I've been trying to figure out how to find Fx and Fy of a moving 2D object with the formula:
Fx = Fapp x cos(θ)
and
Fy = Fapp x sin(θ)
so in unity it would look like
Fx = Fapp x Mathf.Cos(angle)
But unity is not giving me the right values compared to when I do it on my calculator. I think it has to do with something like in this sine graph because the Fx value would fluctuate back and forth between negative and positive values.
I'm using Fx and Fy values to change the direction of gravity to simulate the gravity of the Earth and how it changes depending how far you are from the center of Earth.
Any help would be greatly appreciated!
Thank you!
Comment
What is Fapp? Are you sure angle is expressed in radians? If not, multiply it by Mathf.Deg2Rad
Your answer