0 votes

Hi all,

Here is a video showing the problem.

https://imgur.com/a/hHqQQ

Here is the code, attached to an Area2D. Godot3.0 on Ubuntu.

func _on_Area2DLeftAim_input_event( viewport, event, shape_idx ):
    touchPOS = event.global_position
    $aimingStick/support/target.position.y = touchPOS.y
    print("Touching: ", str(touchPOS))

Can anyone offer any advice as to what's making it go wrong? Thanks so much...

in Engine by (810 points)

1 Answer

+1 vote
Best answer

I guess it should be global_position

$aimingStick/support/target.global_position.y = touchPOS.y

Alternatively, try these two nodes: VSlider and VScrollBar since they work like what you're trying to make.

by (3,939 points)
selected by

Perfect! Thank you. So obvious once you show it. Much appreciated my friend

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories