Questions tagged [mouse]
A very common input device in computer games. It offers a more direct form of movement compared to directional input.
255
questions
0
votes
1
answer
23
views
How to achieve smooth camera dragging with the mouse in SDL2?
I am working on a 2D isometric perspective game using SDL2 and I would like to implement the ability to pan the map when the right mouse button is held down.
I was wondering what is best way to set ...
0
votes
2
answers
66
views
Infinite scrolling with mouse
I know we're able to scroll a background image hardcoded or using awsd keys(or arrows) if they're pressed. But what about scrolling it with mouse movement? So I have a piece of panoramic image as a ...
0
votes
1
answer
175
views
How do I make a 3D cursor that follows the mouse in Godot?
I want to position a 3D object at my mouse cursor. How can I do that in Godot? In Unity, I'd use
Camera.ScreenToWorldPoint.
0
votes
1
answer
146
views
rotating a sprite with mouse cursor
i am learning how to make a 2d game using sdl and c++ and am currently trying to rotate the sprite so that is always facing the cursor, my game is set up with an entity component system, i have a ...
2
votes
1
answer
2k
views
Triggering Enhanced Input Actions via inputs with modifier keys (Shift/Alt/Ctrl) in UE5
This question refers to the use of enhanced input in Unreal Engine 5. Whenever I say "modifier", I refer to modifier keys such as Shift, Alt, and Ctrl (rather than the Input Modifers such as ...
0
votes
1
answer
156
views
Mouse input accumulates different number points at different frame rates
I'm working on a basic Vulkan renderer that's presently relying on Win32 raw mouse input for camera pitch and yaw. It's all very basic, but what I've noticed is that at higher frame rates, I'm ...
0
votes
1
answer
283
views
Unity detect drag to a game object
I want to detect when a UI object it dragged and released on top of a game object. The drags starts on a sprite on the canvas outside of the game object. I tried using ...
3
votes
1
answer
169
views
How Can I Match the Windows Cursor Latency with a DirectX Rendered Cursor?
My Win32/DirectX 11.1 project requires that I render the mouse cursor myself rather than use the system cursor. This is easy enough; however, I've found that there is a human-perceptible latency when ...
1
vote
2
answers
714
views
How to make a collision object within a viewport detect mouse inputs?
I am working on a 2D game with a spatial node (a 3d node) inside a viewport.
Nodes within the viewport should be able to detect user input from what I can find online, but for some reason it doesn't ...
0
votes
0
answers
161
views
Player rotation using relative mouse movement instead of absolute
I'm working on a twin stick shooter where the player looks at the mouse cursor. Like most I use the absolute mouse position and the player's position to determine the direction and derive an angle. ...
1
vote
1
answer
209
views
How to implement a dial control that snaps to increments?
How can I implement snapping via code? I have this 2d circle that the players rotate via drag and it works like a rotating dial. The best way to describe what I wanted to achieve is similar to a clock ...
0
votes
0
answers
234
views
Automatically determining the mouse sensitivity
I have a 3D game. The player can rotate the character left+right using the mouse, and move the character forward+backward using the keyboard. The problem is how to set the speed in which the mouse ...
0
votes
0
answers
110
views
Having GUI on side rather than on game screen
How would I make it so that rather on the game screen the GUI is on the side of the screen and puts the game screen in its own little area so that its not covering part of the screen because right now ...
0
votes
0
answers
113
views
Keeping speeds of camera & mouse movements the same on drag in Unity
So, I am working with Unity's new input system and I have been able to set up movement on the camera so that the user drags the camera around with the middle mouse button. However, there is a parallax-...
0
votes
1
answer
2k
views
Move camera when dragging right and left
I am making a 2D game using Unity, and in the game you see the world from the side like in the first Super Mario games. But instead of moving the camera by walking, I want to move the camera by ...
0
votes
1
answer
104
views
How to handle mouse wheel events in the Pyxel game engine
I'm trying to handle mouse wheel input (aka scroll wheel) on a plain old mouse.
if pyxel.btn(pyxel.MOUSE_WHEEL_Y):
print(pyxel.mouse_wheel)
This never triggers....
0
votes
1
answer
67
views
circles originating from player position not showing up on pygame window
I'm kinda new to python and pygame, anyone know why this won't show bullets coming out from my character?
...
0
votes
1
answer
244
views
How do I change only the angle of a certain PNG relative to the position of the mouse? (Python, Pygame)
Basically, I'm doing a game for a school project and I am not really sure how to make a player point towards the mouse pointer in a pygame tab. also if anyone has ideas of how i could point a bullet ...
0
votes
0
answers
20
views
Why Unity misses some of my mouse click? [duplicate]
So i have a simple shooter game, and i need to shoot with mouse click. I use Input.GetMouseButtonDown(0), but it seems that if I click too fast only a few actually ...
0
votes
0
answers
2k
views
Unity 3D - Make character look at mouse with New input system/Character Controller
So I've been trying to make a top down game with the new input system. Been trying to make the character rotate and look at the mouse's position. The player moves on the x and z axis, with the camera ...
0
votes
1
answer
4k
views
What is the logic behind of ScreenPointToRay?
I'm confused about ScreenPointToRay
Definition of this method says "Returns a ray from camera through a screen point".
I'm trying to visualize it to understand how it works. But its not ...
0
votes
0
answers
182
views
How to add mouse aim to flight script
I am making a flight combat game and I want to add mouse aim to control to the flight script I am using. Is there any way I can add mouse aim to my script similar to Warthunder's mouse aim. Mainly ...
0
votes
1
answer
512
views
Pygame some methods aren't working properly (collidepoint and get_rect)
I'm making a game menu in Pygame, consider the following block of code:
...
1
vote
0
answers
313
views
Unity Input System: How to handle input from specific device types when the binding abstraction fails?
Is there a way for Input System code to determine what kind of device generated an Input Action's current event, so that it can be filtered based on device type?
The example I have is an Orbit Camera ...
0
votes
2
answers
250
views
2D - How to make a gun muzzle aim at the mouse when the rotation pivot isn't on the muzzle?
I'm making a simple 2D shooter game in pygame and I've come across an issue when making the character aim its gun at the mouse.
To make the gun aim up and down, I've set it so that the gun uses the ...
0
votes
1
answer
220
views
Get on what tile has mouse clicked
I am writing a chess game using Java and Swing, And I wanted to get the tile position on which a mouse clicked. I searched through internet, but all of them were really off, and never accurate. When I ...
0
votes
0
answers
25
views
How to detect two different mice at the same time, and record their separate movements? [duplicate]
I would like to use two computer mice simultaneously, and to record data their separate movements on windows. I have successfully used TeamPlayer to create two cursors, but the software that I am ...
0
votes
1
answer
127
views
Measure a distance between the start and end of a drag
I tried to measure a distance from one point to another point on my phone screen by using following code:
...
0
votes
1
answer
119
views
How does time-dependent camera rotation with a mouse work?
The commonly used equation for camera rotation with a mouse does not involve time. This make sense since higher frame rates have smaller changes in mouse position and vise-versa so it all evens out. ...
1
vote
1
answer
2k
views
How to see which mouse button was pressed (Unity Input System)
I have switched my game to use the new Unity Input System, and I want to know which mouse button was pressed when an action is called.
Here's how it's set up:
Whenever one of these three mouse ...
1
vote
2
answers
2k
views
When should I use OnPointerClick vs. Input.GetMouseButton?
In all games I wrote so far, I used Input.GetMouseButton or Input.GetMouseButtonDown inside ...
1
vote
1
answer
106
views
reading input from multiple mice in QB64 in Windows 10?
I am looking to write a non-network multiplayer game for Windows 10 with QB64 that accepts input from 2 or more USB mice plugged into the system. Like a simple Pong game where additional players plug ...
2
votes
1
answer
226
views
What's causing this stutter when framerate fluctuates?
I'm working on a class responsible for arm sway in an fps engine, and am having an issue with a stutter that appears to be related to fluctuating framerate. However I have also noticed it when locking ...
1
vote
1
answer
100
views
The gameloop is stucking the window
I tried to display a player image in a 800x600 window using PyGame but when I try it, the window just gets stuck (immovable with mouse drag, minimize,maximize and close button is stuck and not ...
0
votes
0
answers
199
views
SDL2 - show a tooltip at the cursor that displays RGB of the pixel under the cursor?
I'm writing an SDL2 program, in which I create a SDL_CreateWindow and get its SDL_GetWindowSurface, then I prepare some pixel ...
0
votes
1
answer
4k
views
OpenGL convert mouse position to world coordinates without gluUnproject in Python?
EDIT: I changed the bottom left to -1,-1 and the top right to 1,1, and while I can draw objects within this range, I cannot map the mouse x,y to the world space.
I have been trying to learn OpenGL and ...
0
votes
1
answer
613
views
Stuttery camera with mouse movement
I'm implementing a framerate independent FPS camera and I'm having a problem with jerky camera. The camera is smooth if I translate it or if I make it rotate at a fixed rate, but as soon as I start to ...
0
votes
1
answer
48
views
Why won't my block Spaces/Holders hold my blocks when I drag onto them in Unity?
In my game I am trying to have numbered blocks and math operators be able to be dragged down into their respectively color coded holders (white holders = Numbers, black holders = operations). The ...
0
votes
1
answer
220
views
SetCursor: Cursor does not contain a definition for "SetCursor' or why can't I re-assign the cursor in Unity 20194.7f? [closed]
Here is the code I used on Cursor script, attached to a chest object.
...
1
vote
1
answer
79
views
Best Practices for Locating Clicks
I am building a 2D board game in Unity with a static camera pointed down at the game board. During the active phase of each player's turn, I want to detect where they click on the board. Fortunately, ...
1
vote
1
answer
3k
views
Godot: How to get mouse button input for a Tilemap for Cellular Automata
Conway's Game of Life
I have been working with a tilemap for the implementation of a cellular automata game. My current method for getting mouse button input is using an Area2D as a child of the ...
0
votes
0
answers
353
views
How to properly resize canvas according to screen size? (Javascript)
So, as the question says I need to resize the canvas according to screen size. However the thing is that that's not it. I also need to have the mouse coordinates updated proportionally. Seems like I ...
0
votes
0
answers
73
views
How to reverse the movement of the mouse on the X and Y axes?
I would like to know, how to do so that when moving the mouse to the right, it would go to the left and vice versa.
I looked for something related on the gamemaker page, but I didn't find what I'm ...
0
votes
1
answer
38
views
Question about taking mouse input in unity 2D
I'm learning a course on unity and when we started learning about taking mouse input the following code is used.
...
0
votes
0
answers
74
views
Java clicking on tiles detection
I am making small isometric game, where I want to do something when user clicks a tile. I can simple do it by mouse location, but I want to be able for zooming and moving camera. It will be 2D game ...
0
votes
1
answer
162
views
I accidently changed the cursor image in Unity
In the Unity Editor I accidently changed the image for the mouse cursor in project settings > player
How can I restore it to the default, preferably not through programming?
1
vote
2
answers
376
views
Rotate object always at same speed on screen, no matter camera distance?
I am rotating a globe like XCOM's hologlobe,
I rotate it using Quaternion.RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta).
I found a good value for ...
0
votes
1
answer
2k
views
In Unity, how do I make text/annotations appear when I mouse over GameObjects in playmode?
How do I make text appear when I mouse over GameObjects in-game? What is the Unity jargon for this? I'm assuming it's 'annotations'.
0
votes
0
answers
597
views
Mouse detect object without Collider?
Is there any method for mouse or ray to detect object doesn't have collider ? If no, what also can I use ?
0
votes
1
answer
73
views
Way to Prevent Stacking Pieces
I have a chessboard with all the black pieces that move with this code:
I found that when I move the pieces, they will stack on top of each other. How can I prevent this?
I have since changed the ...