platform-documentation icon indicating copy to clipboard operation
platform-documentation copied to clipboard

API update to include locking the mouse to the center of the screen, or a way to obtain mouse delta movement directly.

Open qJesusp opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. It's difficult, maybe impossible, to make custom first person camera systems (that don't use lock to player). The problem I have is obtaining the mouse delta to update the camera rotation based off of the mouse movement. When using UI.GetCursorPosition() to retrieve the cursor position and comparing it to the position of the previous frame to generate a mouse delta, the cursor may collide with the edges of the viewport. This collision restricts the cursor's movement, and leads to false mouse delta data.

Describe the solution you'd like If there was a function to manually set the cursor's position, one could set it to the center of the screen after cursor movement was detected, and then use the data from the cursor movement to generate mouse delta data. Another possible solution would include a UI.GetMouseDelta() that returns a vector2 value containing the movement of the mouse during the previous frame.

Describe alternatives you've considered Simply using the First Person Camera template would be the most straightforward solution, but I want more freedom over the camera's positions and data. Whenever the camera is locked to the player, the :GetWorldPosition() and :GetWorldRotation(), as well as the functions to set them don't work properly.

Additional context Here is a forum post I've made about the issue https://forums.coregames.com/t/cant-reliably-obtain-mouse-delta/2755

Thank you.

qJesusp avatar Feb 01 '22 21:02 qJesusp