![]() |
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