# Wrong angle when I'm trying to throw a RigidBody2D

Attention Topic was automatically imported from the old Question2Answer platform.
Asked By Davi Bandeira

First of all, sorry for my bad english, I’m learning.

My problem is, I have to throw a rigid body, like a ball in a Ballistic Curve, simulating a rotation (When I’m in the angle of 90 degrees, the ball should be throwing to the left, not to the up).

Example of the correct angle: https://drive.google.com/file/d/1a8H3GGz6RnY7RpZMa2rob76XsJTjCN94/view?usp=sharing

I’m using the current code:

``````extends Node

var angleStop
var radius = 30
var rpm = 4

func _on_Button_pressed():
var impulse; var lock
lock = Vector2(0, 0)

impulse = get_impulse_vector(angleStop, rpm, radius)
\$groundBody/ballBody.apply_impulse(lock, impulse)

func get_impulse_vector(angleStop, rpm, size):

angleStop = 90 * PI/180
var fx = size * cos(angleStop) * radius * 0.10471975511965977 * rpm
var fy = -size * sin(angleStop) * radius * 0.10471975511965977 * rpm
var out = Vector2(fx, fy)

return out
``````

With this code, the ball is thrown to the up, not to the left, someone can explain me why ?

Probably because you are setting this wrong in this line

error - Album on Imgur

gamedevshirious | 2021-12-04 17:41

Reply From: flurick

Radians are used internally, and they assume 0 is to the right?

Reply From: SpkingR

In your code snippet, the function `get_impulse_vector` always return `Vector2(0, -1)`, so the direction is not LEFT but UP.

``````var fx = size * cos(angleStop) * radius * 0.10471975511965977 * rpm #fx = 0
var fy = -size * sin(angleStop) * radius * 0.10471975511965977 * rpm #fy = -1
var out = Vector2(fx, fy) //so, out = (0, -1)
``````

you can change the `angleStop` to 0, `fx` to `-fx` to get the right direction.