0 votes

Hi, it's my first time asking question at here, forgive me if I done anything wrong XD.

I've added a child(tooltip) to my scene and change its position everytime my mouse move within the TextureButton.

func _process(delta):
if follow:
    if previous_mouse == null:
        previous_mouse = get_global_mouse_position()
        if previous_mouse != get_global_mouse_position():

func _on_TextureButton_mouse_entered():
    var tooltip_instance = tooltip.instance()
    follow = true

func _on_TextureButton_mouse_exited():
    previous_mouse = null
    follow = false

It works if I move my mouse up and left, but when moving down and right, the placement of the tooltip seem out of place. Could anyone helps me figure it out what is happening?

The problem:

Thanks in advance!

Godot version Godot 3
in Engine by (16 points)

It's stange, I've not tested these options but you may try:

a) Change the logic to only call the function when a mouse motion event triggers:

func _input(event):
    if event is InputEventMouseMotion:
        #Do logic here

b) Try to interpolate between the current position and the new position, it may not correct it completely but will help with the jitter.

2 Answers

0 votes

Have you tried replacing the image with another which doesn't have any transparency. It looks the the transparent pixels in the Godot icon is tripping it up.

by (36 points)

Thank you for the answer! I've tried it, but it still has the same problem

0 votes

Thanks for the responses guys, much appreciate!
I'm not 100% sure about that, but I suspect that it's because whenever my mouse hover to the right/down side, the cursor enters the tooltip. Seem like Godot considers it as my cursor already left the TextureButton and removes the tooltip.

I added offset for the toolip position and it seem like the problem is solved.


by (16 points)

Well done - glad you got there!

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 Frequently asked questions and 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 [email protected] with your username.