2D kinematics
I am trying to make a calculator and for some reason the time is not showing right. Am I doing something wrong with my equations? I get 1.73 and the online calculator gets 1.44... My angle is 45 degrees and my velocity is 10 m/s
vx = float.Parse(velocity.text) * Mathf.Cos(float.Parse(angle.text));
vy = float.Parse(velocity.text) * Mathf.Sin(float.Parse(angle.text));
time = ((2 * vy) / g);
distance = vx * time;
print(time);
$$anonymous$$athf.Cos/Sin/Tan take an argument in radians, you can multiply by $$anonymous$$athf.Deg2Rad;
Answer by elenzil · Apr 04, 2018 at 07:34 PM
sin() and cos() take in radians, not degrees.
so this:
Mathf.Cos(float.Parse(angle.text))
should be this:
Mathf.Cos(Mathf.Deg2Rad * float.Parse(angle.text))
.. and similar for Sin() as well.
Your answer
Follow this Question
Related Questions
In what way do units matter when providing density for Collider2Ds? 0 Answers
What is the parabolic formula for a 2D projectile's trajectory 1 Answer
Physics2D, impersonate old RigidBody2D "Freeze Position" How? 1 Answer
RigidBody becomes awake without a collision 1 Answer
How to make object with velocity bounce off the obstacles? 0 Answers