Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor following the mouse - Position passed to cursor from update function => conflicts #26

Open
Ragetto opened this issue Oct 4, 2021 · 1 comment

Comments

@Ragetto
Copy link

Ragetto commented Oct 4, 2021

From Defold forum
https://forum.defold.com/t/rendercam-defold-input-weird-cursor-position-when-scrolling/69387/6


DEFOLD INPUT (cursor)
(+ camera? not sure there is a link)

Real-time following... when not moving the mouse
When passing the "follow position" message from the input function (as recommended by Britzl), the cursor doesn't follow the mouse when this mouse doesn't move (ex: after scrolling and move moving => the mouse keeps its screen position while the cursor follow the camera movement)

What I did do to make the cursor follow the mouse no matter what?
I’ve added the message passing (to the cursor) in the update loop, which makes the cursor follow the mouse as intended... but it seems to have created some sort of “conflicts” with the other cursor’s action_ids...

Recap
When passing the "follow position" message from the update loop, the “release” input is no longer detected after I have clicked the building. I have to move the mouse to "confirm" the release and upgrade the building.


Here is a minimal version of the project here:
https://github.com/Ragetto/20211002_-PUBLIC-_defold_input_cursor

@britzl
Copy link
Owner

britzl commented Nov 16, 2021

after scrolling and move moving => the mouse keeps its screen position while the cursor follow the camera movement

Yes, this happens since the cursor is based on the position of the cursor game object and it follows any camera offset.

The solution is:

I’ve added the message passing (to the cursor) in the update loop, which makes the cursor follow the mouse as intended

BUT apparently this causes a problem:

When passing the "follow position" message from the update loop, the “release” input is no longer detected

I believe the only proper solution is to move from a collision object to ray casts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants