Questions tagged [mouse]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
229 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
147 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
115 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
341 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 ...
4
votes
1answer
81 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.
11
votes
2answers
3k 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
281 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
1k 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
98 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. ...
3
votes
0answers
373 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) ...
4
votes
3answers
4k views

How can I make the player “look” to the mouse direction? (Pygame / 2D)

Here's my code: ...
0
votes
1answer
39 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
3k 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
22 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
325 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
594 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
901 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
168 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
7k 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
753 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
305 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 ...
2
votes
1answer
870 views

In Unity, Change which mouse button is used to scroll in ScrollRect

I've created a new ScrollView in Unity. How do I change which mouse button is used to scroll in ScrollRect (through script or in the editor). By default it's the left mouse button. I'd like to be ...
0
votes
1answer
117 views

How do I select a portion of the window using Love2d

I want to be able to divide the window of the game in, lets say, 3 places, and when the mouse (or touch) click one of those places, execute some code. Do I have to make each portion a button-like ...
0
votes
1answer
4k views

How to get which gameobject the mouse is over in Unity?

So I'm working on a simple drag-n-drop based trading card game for my own amusement. There is a card inspector included. What I want to achieve is to change values in the inspector (which has its ...
0
votes
1answer
187 views

How to move 2D objects based on mouse movement with pointer locking?

I'm using pointer locking for a 2D game (where you perform calculations based on the delta in mouse positions from frame to frame). I'm having some basic math/logic issues with accomplishing what I ...
1
vote
1answer
613 views

Game Maker Studio - Check Collision With Subimages

I have an obj_roulette, which contains 4 subimages, with value 2-5 and image_number 0-3. The ...
-3
votes
1answer
2k views

Make object follow mouse cursor in unity [closed]

I was watching a tutorial on how to move objects on mouse movement. https://youtu.be/7OJQ6MbHuvQ this is the link to that tutorial and below is the error I got while scripting. Please watch the ...
1
vote
1answer
2k views

Unity 5 - Mouse Disappears during runtime

My mouse cursor disappears during runtime. When I click esc, it appears and the moment I click on something, it disappears again. This is what I have done so far to fix this. I have added this to a ...
3
votes
1answer
957 views

Calculate Relative Mouse Movements Regardless of position

Context I'm working on making a variant of the atari game Breakaway IV and I'm trying to improve my mouse input handling. I use the input of a mouse's motion left and right to move the bumper. <...
1
vote
1answer
709 views

Boolean change when clicking the left mouse button (not working)

I want to change a boolean when I click the left mouse button, but it doesn't work as expected. I use this method: ...
3
votes
3answers
430 views

Sending a players mouse movement to the server in an FPS

So I have a server-client model FPS set up. It uses udp to send data between the two with the server having a constant tick rate of 100 ticks per second (It updates movement 100 times a second) on the ...
2
votes
2answers
187 views

Camera movement in unity engine

I have a basic camera setup which is angled like so: x: 30 y: 0 z: 0 Projection: Orthographic And i attached a C# component to it and made it so the camera ...
1
vote
2answers
206 views

OnMouseClick not detected

I created "main script" and in Start() created simple cube: ...
15
votes
6answers
15k views

How to properly differentiate single-clicks and double-click in Unity3D using C#?

What I am trying to understand and learn here is a very basic thing: what is the most general and most polished way to properly differentiate single-clicks and double-clicks for the 3 main mouse ...
1
vote
2answers
941 views

Detecting Left and Right Mouse clicks on UI Text objects that are dynamically created

So, in my game I create a bunch of UI Text game objects dynamically (in the C# script), but I just can not find out how to properly detect Left and Right mouse clicks on these UI Text that were ...
4
votes
1answer
132 views

Selecting the closest point in perspective view mode

I'm trying to improve my algorithm for selecting points in perspective view mode (OpenGL/Qt/C++). The current implementation works as follows. The user clicks on a certain ...
1
vote
1answer
88 views

Help with open and close UI Menu on background mouse click

I am trying to make a point and click game in unity 5.2.2. My problem is that I need to have a UI menu to open, when the player clicks with the left mouse button on the background sprite, and it ...
2
votes
1answer
252 views

Isometric Mouse Camera Panning

I am building an isometric game environemnt and i want to be able to pan the camera around the map by holding the right mouse button, can someone talk me through the logic for this please, i have made ...
3
votes
1answer
12k views

How to get direction and velocity of movement of an object dragged with the mouse in Unty (C#)

I have an object that is dragged by the mouse (X and Z positions) over a table, with the following simple code: ...
2
votes
1answer
768 views

How to disable camera moves (mouse drag) in an Unreal Engine editor plugin?

I tried to override FEdMode: ...
2
votes
1answer
1k views

How to get the mouse events in an unreal engine editor plugin?

I would like to react to user inputs in an editor plugin, how can I do that? In a game I can use a custom Pawn or a custom PlayerController but how can I do it in the editor?
8
votes
2answers
1k views

How do I create a draggable object which snaps to obstacles in the way?

I bring yet-another-drag-with-mouse question (I am using Unity with C#), but with a less common particular detail: the existence of obstacles in the middle of the way trough which dragging occurs (3D ...
3
votes
3answers
1k views

Unity Click make Jump and Pause

I use Unity 5 and I have an issue with my game, when I click on the Pause button my character jumps before the game is paused. My script detects the click for jump before the pause button so for that ...
9
votes
2answers
33k views

How to detect mouse over for UI image in Unity 5?

I have an image that I have setup to move around and zoom in and out from. The trouble is the zoom can be done from anywhere in the scene, but I only want it to zoom when the mouse is hovering over ...
3
votes
1answer
469 views

convert mouse coords to zig-zag isometric

I was wondering, how do I convert mouse coordinates to zig-zag isometric coordinates? I already know how to convert to isometric using the Diamond approach, so I just need to know about the zig-zag ...
1
vote
1answer
282 views

What algorithm is used to select a voxel (from a player's perspective)?

In first-person voxel games (like Minecraft, shown below) you can select voxels by going over them. What kind of algorithm is used to select a voxel? I haven't implemented it in my voxel application ...
0
votes
1answer
690 views

Getting mouse movement value with DirectX Tool Kit

today I want to ask a question about how to get mouse movement value with DirectX Tool Kit. While I can certainly use Mouse::SetMode(MODE_RELATIVE), to do this, I ...
6
votes
3answers
3k views

Get OnMouseDown to work with a 2D Polygon Collider

I'm having a hell of time getting a 2D polygon collider to register a mouse click. I've attached images and code to show where I'm at. I cannot get the click to work. Ultimately, the thing I'm trying ...