Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | ManiCus |
Bullets in 3D going: Up when looking down, down when looking up
That only happens in the “y axis” while looking to the sides and shooting works correctly.
that is the code: Imgur: The magic of the Internet
func _physics_process(delta):
-------disp()
var bala = load(“res://Assets/Escenes/armes/pistola/bala.tscn”)
func disp():
----------if Input.is_action_just_pressed(“disp”):
----------------var b = bala.instance()
----------------get_parent().get_parent().get_parent().add_child(b)
----------------b.global_transform = $punt_b.global_transform
----------------b.apply_central_impulse(get_parent().get_parent().xform(Vector3(0, 0, 100)))
This issue happens only when you look straight up or down?
AlexTheRegent | 2022-06-30 23:00
I can rotate horizontally to any direction, but when I look up/down, the issue happens. The bullet is shot to the front, as it should be, but up when looking down and down when looking up.
When I am not looking either up or down, just looking to the front, the bullet is shot straight, with no curvatures (as it should be)
ManiCus | 2022-07-01 10:38
try
get_parent().get_parent().get_parent(). … etc
var main = get_tree().current_scene
example
main.add_child(b)
ramazan | 2022-07-01 11:41
Thanks for the advise!
ManiCus | 2022-07-01 13:08