**Question**by Quote_ · May 20, 2020 at 04:02 AM · rigidbody2dgravityprojectilerigidbody.velocityrigidbody physics

# Projectile Motion arc with Rigidbody 2D,Projectile motion with 2D physics.

Hey folks, i am having some problems with the 2D physics rn and was wondering if someone had a similar problem and could help.

i am making an parabolic motion simulator where the user gives the angle and initial velocity and then they see an canon shooting the bullet with the infos about the X and Y position alongside a graph showing the equation. But when i try to compare the results of the equation and the real results ingame they differ by around 0.1 ~ 0.2 and i can't figure out what's wrong

The Code for the equation`

```
var g = -Physics2D.gravity.y;
var height = 0;
var initialVelocityX = (player.velocity * Mathf.Cos(Mathf.Deg2Rad * player.angle));
var initialVelocityY = (player.velocity * Mathf.Sin(Mathf.Deg2Rad * player.angle));
var time = (initialVelocityY + Mathf.Sqrt(Mathf.Pow(initialVelocityY,2) + (2 *g * height) ) ) / g;
Vector2 pos = Vector2.zero;
pos.x = initialVelocityX * time;
pos.y = (initialVelocityY * time) - (g * Mathf.Pow(time, 2) * 0.5f);
Debug.Log("Total Time (Equation): " + time);
Debug.Log("X position:" + pos.x);`
```

and the launch script is just ` buInst.rb.velocity = new Vector2(Mathf.Cos(Mathf.Deg2Rad * angle) * (velocity), Mathf.Sin(Mathf.Deg2Rad * angle) * (velocity)); `

the distance i print on the game screen is the distance that the bullet travels by ` transform.position.x - initialposition.x `

**Thanks in advance if someone can help ^ ^**

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.