- Home /
Input.mousePosition is broken, anyway to make it accurate?
https://www.youtube.com/watch?v=lehv54eCs50
Provided is a YouTube video showcasing the fact that Input.mousePosition is just plain broken for my game.
I'm trying to destroy GameObjects based on the mousePosition, but when I click somewhere, it removes a block from somewhere almost opposite of where the mouse actually is located. Does anyone know a fix for this issue?
Before you claim it's broken, perhaps tell us what kind of values do you expect it to give you. Then check if your expectations are reasonable from the Unity manual
Answer by Kishotta · Aug 27, 2017 at 03:41 PM
How are you using Input.mousePosition
? It looks like your camera is moving within your scene. Are you taking that movement into account when selecting which gameobject to destroy?
The issue was a result of using Raycasts and normalizing mousePosition. I was casting from the position of my player to my mouse, which also destroys stuff in the way.
Your answer
Follow this Question
Related Questions
Unity ads , can't we show video by clicking a button? 1 Answer
Create clickable GameObjects (JS) 1 Answer
Problem with texture to reset and re-enter the same texture 0 Answers
one button to hide and unihed gameobjects 0 Answers
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers