Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [mouse]

A very common input device in computer games. It offers a more direct form of movement compared to directional input.

0
votes
0answers
14 views

ImGui: disable window move with drag event on image

I'm displaying an image with ImGUI like this: ...
0
votes
2answers
60 views

How to panning camera on XZ axis with different angles

I have an Orthographic camera where the position is { x:0, y:100, z:0 } and is pointing/looking at { x:0, y:0, z:0 }. At this ...
0
votes
1answer
25 views

Drag object with mouse in diagonal direction

I have a gameobject which i want to move using mouse. Currently i can do that in x-axis and y-axis: ...
0
votes
1answer
48 views

Move camera while dragging with mouse

I'm currently trying to implement a move-to-drag behaviour in a 2d grid based game. I want to update the camera such that if follows the "head" of the trail being drawn - In this case, the nodes it is ...
1
vote
1answer
95 views

Drawing many separate lines using mouse OpenGL(GLFW/glad)

So, in order to draw a line, I track the coordinates of the mouse, then I add them to the array and capture it as GL_LINE_STRIP_ADJACENCY. However, for example, I completed drawing a line1 at P1 and ...
1
vote
1answer
93 views

What is the difference between a hotkey and a shortcut-key in a game?

I was wondering: What is the exact difference (if there is any) between a hotkey and a shortcut-key in a game? Some games for example allow the player to bind certain actions to a specific key and ...
0
votes
2answers
76 views

How can I make the cursor avoid something completely?

I wrote some code for a UI button that causes the mouse to avoid it. I realize this is kind of a weird thing to do in a game design-wise, but this is a really weird game. I need a button that is not ...
1
vote
1answer
65 views

How do I calculate a new position from current and target position for intuitive non-instant dragging?

I have a simple 2D game where I can move an object using the mouse. I've been improving on the 'feel' of the movement gradually, however it still doesn't behave as you'd expect if the object were to ...
0
votes
1answer
165 views

unity 3d mouselook script help, weird issue

I'm coming back to Unity after a year or two of busy college and I'm having to relearn everything I've forgotten. One thing I cant seem to get right is this basic mouselook script I wrote. Here is the ...
0
votes
1answer
55 views

Rotating Weapon Towards mouse.position

OK guys i have tried lots of things and researched but cannot find a solution please someone give me hope.. So on my phone when i am playing i want to shoot with a screen button in the canvas that is ...
0
votes
1answer
104 views

How to know if mouse coordinates is delta or absolute on Window and Android in Unity?

I wrote sample application, that allows to "rotate" object by mouse. Rotation occured by rotating of camera object around central object and the code is following: ...
0
votes
0answers
19 views

Mouse: Intelligent Focus Helper

h.e.l.l.o I tried to get a kind of focus helper with the mouse when the pointer rolls over an item. but i can get a good easing when the mouse are hover a element. I do not know if I explain myself ...
0
votes
1answer
39 views

Detect if mouse do multiple circle rotation around a XY point

would anyone know a method or algorithm (js) to calculate and detect if a mouse is moving by a circle around a target? Example if a rotate mouse *4 time around a specific XY point, i would like to re-...
-1
votes
1answer
52 views

Having trouble making more than 1 clickable object

I am a student trying to figure out how to make multiple clickable objects in pygame. I was able to make 1 working clickable object (dx,dy) work, but when I tried to make another clickable object (qx,...
1
vote
2answers
95 views

How do I convert OnCollisionEnter2D to OnMouseDown?

I created a simple animation. I have a "Gamer" object, which I move and hit squares to destroy them. Squares I have to destroy in the right order ...
0
votes
1answer
97 views

Why does the object not move correctly when I press the right mouse button?

2D Game in UNITY C# I have an object BULLET . After pressing the left mouse on my object (BULLET), the script allows me to rotate object according to the mouse's direction, in four directions : -...
0
votes
0answers
19 views

Problem with trying to replicate my custom mouse rotation to all the clients

Greeting everyone! I'm working on multiplayer FPS project with some custom mechanics for which i need custom mouse function. Problem is, mouse cam rotation works only on clients, but not on server, ...
0
votes
2answers
56 views

How to keep clicks from menu from interfering with game state?

I ran into a problem coding my game in which when I click the play button on the newly implemented menu, it also creates a bullet from my player. The player and the menu both rely on the mouse input. ...
1
vote
1answer
28 views

Mouse position not updating while mouse buttons are pressed

I have a simple mouse manager class: https://imgur.com/MuUhh73 Whenever any of the mouse buttons are pressed the mouse position does not update when calling ...
-1
votes
1answer
19 views

Help me understand the numbering of buttons in GetMouseButtonDown

I'd like to know what the "0" stands for in this code: if (Input.GetMouseButtonDown (0)) // Do something here
0
votes
0answers
362 views

Unity2D - Throw a Ball with Mouse

Apologies if this is obvious, I don't have a super good handle on physics - currently doing Khan Academy to catch up. I'm trying to set things up so I can pick up a ball with the mouse, drag it, and ...
0
votes
1answer
193 views

Trying to get an object to move in the mouse direction XNA C#

Right, so in my Player class where I call the object I got an if statement which gets the coordinates for the mouse ...
0
votes
1answer
164 views

How can I attract & repel the mouse cursor from particular UI controls?

This question came from some of my students. I wanted to share it here so others can find & improve on the solutions we've found so far. In particular, my answer below doesn't behave as well as I'...
0
votes
1answer
142 views

2D Screen Coordinates to 2D World Coordinates in LWJGL

I'm making a 2d top down game with lwjgl and am having trouble converting my 2d screen coordinates to 2d world coordinates. Here's what I have so far ...
1
vote
0answers
201 views

Is there a way to get mouse coordinates relative to an sfml window without locking the mouse to the window border or monitor edges?

As the title states, is there a way to get the relative mouse coordinates to the sf::RenderWindow without locking the mouse cursor inside of the window border or monitor edges? In glfw using a mouse ...
1
vote
1answer
184 views

SDL2 dragging a sprite with mouse

I am trying to figure out how to drag a sprite. I know when the mouse is being hovered, pressed, or released over a sprite. I don't know how to tell if the mouse is being pressed and moved at the same ...
1
vote
1answer
156 views

How can I process extra mouse buttons using Monogame?

I use Monogame for game development. For processing mouse input, I can use the Mouse class to query basic information like left click state, right click state, and ...
3
votes
1answer
135 views

Compare mouse movement to the pattern

There are some games where you need to make special movement with your mouse (spell casting or any other action). Something like this So basically, how can I compare mouse movement to my pattern (...
0
votes
0answers
51 views

How to abstract mouse movement event streams for networked multiplayer?

I'm building a mouse driven 3rd person shooter with client-server network architecture. My input system is event based. Keyboard input is captured by keys.S.onUp() ...
1
vote
1answer
111 views

How can I calculate respective 2D world/mouse position through different resolutions?

I have been at this game of trial-and-error for days now. I cannot find a consistent method to calculate the respective mouse position in my game world after the calculations are done to stretch the ...
2
votes
1answer
241 views

How does mouse input work in 3d games? [closed]

How does a game process cursor movements? I know it calculates offset from the middle of the screen, but how? What constraints is that cursor having? Is it locked to the middle of the screen/a ...
5
votes
1answer
68 views

How can I use more than one mouse connected to the same computer as different input devices in Unity?

How can I use more than one mouse connected to the same computer as different input devices in Unity? I want to read the input axis of each mouse individually for local multiplayer games.
0
votes
0answers
287 views

Quaternions and Camera Implementation

I'm using OpenTK to make a camera rotation around with the mouse, and I'm using Quaternions to achieve this. But I ended up with results I don't want(2 Problems). Problem 1: The Camera Rolls on z-...
12
votes
2answers
2k views

How to make a delayed mouse input?

I have a car game and the idea is that the player is drunk. I want to have a delayed input from the mouse, where you move the mouse side to side to turn. How can I setup a constant delay between the ...
0
votes
1answer
193 views

Drawing Sprites Depending On Mouse Position (LibGDX)

I'm making a small game where you play as a turret in the middle of the screen trying to shoot the enemies coming after you. I am having difficulties, however, in trying to figure out how to make the ...
0
votes
2answers
789 views

Touch a specific area on the screen in Unity 5

I am building a Roulette game in Unity 5. I want to place bets on a Roulette table when I touch specific areas on the screen with mouse(PC) and touch(mobile). For example when i touch Number 1 on the ...
1
vote
1answer
75 views

How can I make part of a JLabel visible under mouse movement?

The JLabel has an image of a room. I want the mouse to act as a flashlight, and only display around the mouse the part of the JLabel/image that the mouse is hovering over, in a large circumference. ...
2
votes
0answers
324 views

Why is my 2D mouse aim not working properly?

I'm trying to program 2D mouse aim, where the arms and the gun in the arms rotates to point at the mouse. But for some reason, the arms and gun rotate and do not follow the mouse position. The each ...
1
vote
1answer
30 views

Reversing translational dependency of Sprite on Mouse instantaneously at runtime without causing the sprite to jump

Help me think through a logical way to implement the desired effect. Goal: (I'm using Adobe Animate CC 2017 targeting AIR for Desktop) Move a sprite using a controller (mouse on a PC for instance) ...
3
votes
3answers
2k views
0
votes
1answer
37 views

How to check mouse coordinates and mouse events

I'm building a simple game where if the mouse's X coordinate is greater than 200, and you click, the screen will turn red. Here's the code: var mouseX = event.clientX; var mouseY = event.clientY; ...
0
votes
3answers
2k views

Detecting mouse click for the uppermost layered 2d sprite in Unity

I have two sprites. One for the entire background and another small sprite, which is a foreground object. I have written code for both of these objects in their ...
0
votes
1answer
18 views

Wrong object is being detected on OnMouseUpAsButton

In my 2d game project I have an object A moving above map. Both object and map have colliders (circle collider and polygon collider respectively), as well as actions to be performed on ...
0
votes
1answer
242 views

Unlock cursor through script

I am using unity's default FPS controller script. My game switches scenes, and when it does I can't move the mouse. I know that this is because of unity's m_mouselook's lock cursor is on. What I don't ...
-1
votes
1answer
466 views

Missing Reference: Unity should clone object before destroying

For a small RTS Project, I'm working on the pointer. I want a pyramid as a marker on the terrain, that indicates the selected position, sinks into the ground and disappears. For the next interaction ...
1
vote
1answer
666 views

Custom Unity mouse input with WM_INPUT - receiving weird values

About I am trying to get the raw mouse input of the system into a C# application. I am using WM_INPUT (MSDN link) to get access to the data. To do so I am using ...
0
votes
1answer
97 views

Why is my mouse disappearing at runtime?

I'm using Unity 5.3.5f1 and every time I play my game in the editor, my mouse disappears. I really need to test some of my parameters in the inspector but I can't because the mouse is gone. How can I ...
1
vote
2answers
5k views

How can I get UI element over which pointer is in Unity3D?

I can detect if mouse is hovering any UI element by EventSystem.current.IsPointerOverGameObject(). But how do I know which ...
2
votes
1answer
519 views

Setting up a custom cursor image in LWJGL 3

How can I load a custom cursor image with LWJGL3? It took me a while to figure this out. Here is how it is done for version 3.0.1. Hope this helps.
2
votes
2answers
259 views

object smooth orbital limit around another object depending on mouse drag

I am working in Unity. I have special objects that can each be dragged freely around in 2d. The objects cannot get too close to other objects (minimal Vector3.distance allowed is 1.5f). I also have ...