# Vector2 - Question

Looking for clarity on apply_impulse. I asked ChatGPT how to read the description on Godot: “void apply_impulse(impulse: Vector2, position: Vector2 = Vector2(0, 0))” because from my understanding, “impulse: Vector2,” is the impulse amount on the x-axis, and “position: Vector2” is the impulse on the y-axis. And “Vector2(0, 0))” is the default and example of Vector2’s default value for impulse.

My confusion is because ChgatGPT explained it in a way where it said it does not have anything to do with x/y coordinates. Maybe I’m misinterpreting/misunderstanding what it meant. Some clarity could be helpful!

Chatgpt explanation:
The function signature void apply_impulse(impulse: Vector2, position: Vector2 = Vector2(0, 0)) doesn’t represent a 2D coordinate system with x and y axes. It represents a function with two parameters:

impulse: Vector2 : This parameter expects a Vector2 value, and it’s used to specify the force or impulse you want to apply along a direction. It’s not related to the x-axis or y-axis.

position: Vector2 = Vector2(0, 0) : This parameter also expects a Vector2 value, and it’s used to specify the position where you want to apply the impulse. The default value is (0, 0) , which means if you don’t provide a position when calling the function, it will assume (0, 0) as the position.

The function is not related to a 2D coordinate system with x and y axes. Instead, it’s used to apply forces or impulses to objects in your game or simulation at specific positions ( position ) with specific directions and magnitudes ( impulse ).

hi , yea that does sound confusing to read in the first instance.

my understanding is that there are two parameters to apply_impulse

the first Vector2 argument is the force vector you want to apply to the object.

the second Vector2 is a position where you want to have the force vector applied to, this is in global coordinates and relative to the body you want to affect.

ive done a little sketch on how i believe it works, i might be wrong, but this is how i understand it

how a pic helps

(EDIT : all i have access to is paint just now, excuse my spelling mistakes, oops)

1 Like

Oh, this makes more sense now! So since it’s defaulted at 0,0 it would naturally just put the impulse force in the center of the object. Thanks for the help

1 Like

thats my understanding. i kind of tought if it like playing pool and putting top or backspin on the ball.

hope ive not got the wrong end of the stick, but thats how it sounds to me. honestly, never used it personally

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.