Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse pointer erratic behaviour #245

Closed
ciro-unity opened this issue Dec 1, 2020 · 10 comments · Fixed by #250
Closed

Mouse pointer erratic behaviour #245

ciro-unity opened this issue Dec 1, 2020 · 10 comments · Fixed by #250
Labels
bug (important) This needs to be fixed before shipping, but not as a first priority

Comments

@ciro-unity
Copy link
Contributor

Short description
Sometimes, the camera spins very fast when using the mouse to control the camera, even if the mouse is moved by a tiny fraction.

Expected behaviour
The camera should follow the speed of movement of the mouse.

To Reproduce
Steps to reproduce the behavior:

  1. Open the scene "TestingGround"
  2. Press Play
  3. Once the game is in Play Mode, hold down the RMB and move the mouse left or right by a very tiny amount.
  4. Notice the camera spins around a full circle, before resuming at the right speed.

Notes

@ciro-unity ciro-unity added the bug (important) This needs to be fixed before shipping, but not as a first priority label Dec 1, 2020
@kgc00
Copy link
Contributor

kgc00 commented Dec 2, 2020

hi @ciro-unity , i just saw this- we could just have mouse movement without RMB to sidestep this. sound good? I'm also down to debug if you'd like.

@adoart
Copy link

adoart commented Dec 2, 2020

It looks like it depends where the click starts, the further from the center bigger the rotation, @ciro-unity clicked once close to the center and rotation was little. That's what I got from the video...

@khush2o2o
Copy link

I known this bus to how to solve...

@drbier1729
Copy link

Just tried to check this out but I'm unable to replicate the issue.

I'm guessing that maybe the InputReader or InputSystem isn't updating the cursor's position when it jumps to the center when the cursor is locked (in CameraManager.cs). This causes the mouse delta on the first frame when the mouse is moved after enabling camera controls to be crazy high since it is calculating the difference between the position where the RMB was clicked and the center of the frame.

I'm pretty new to Unity so this might be incorrect, but hopefully this noticing is helpful! I'll keep working on it but without being able to recreate it, I'm not optimistic about producing a fix.

@khush2o2o
Copy link

I have an idea to slove this bug...

@ErikBehar
Copy link
Contributor

I have an idea to slove this bug...

Please provide the idea in writing or a link to the PR, stating that you know how to solve a bug with no further info is not useful to anybody.

@ErikBehar
Copy link
Contributor

ErikBehar commented Dec 2, 2020

ok so I think @drbier1729 has it correct ... you can more easily replicate the issue, by popping out the game window, then click outside so the window looses focus and then click back into the window to get focus, then rm on the edge of the window. You will get the crazy spin and yeah I think its due to the initial difference.

with the above steps you can replicate the issue many times within 1 play session.

So this is caused by the cursor lock placing the mouse at 0,0 ... you get the initial diff ...

This can be fixed by adding a small wait time, before allowing camera movement when you enable the cursor lock:

      private bool cameraMovementLock = false;
      ...

       private void OnEnableMouseControlCamera()
	{
		_isRMBPressed = true;

		Cursor.lockState = CursorLockMode.Locked;
		Cursor.visible = false;

		StartCoroutine(DisableMouseControlForFrame());
	}

	IEnumerator DisableMouseControlForFrame()
	{
		cameraMovementLock = true;
		yield return new WaitForSeconds(.1f);
		cameraMovementLock = false;
	}

      ... 

	private void OnCameraMove(Vector2 cameraMovement, bool isDeviceMouse)
	{
		if (cameraMovementLock)
			return;
         ...

@davejrodriguez
Copy link
Contributor

Could someone who was able to reproduce the bug test #249?

@drbier1729
Copy link

@ErikBehar Cool! Thanks for finding a better way to replicate it. And I was thinking the same thing for a potential workaround, but there was no way for me to test it earlier today haha.

@davejrodriguez I'll check out your work tomorrow morning if I can recreate the bug using the steps ErikBehar suggested.

@ErikBehar
Copy link
Contributor

I think some of what @davejrodriguez did is probably good, but needs a bit more work ... I've added the simple fix mentioned above meanwhile.

ciro-unity added a commit that referenced this issue Dec 5, 2020
* hair color mask material, old lady hairdo and glass, moustache, and shell bowl

Various art assets to make the townsfolk more unique. Bowl made from a giant shell.

* Fix Plant Critter mesh scaling and name (#239)

* Townsfolk_M animations, Palm2

* New tree type

* simple fix for camera

* Reset HasBeenPrewarmed (#243)

* [WIP] Added some table furniture (#233)

* Added some table furnitures

* Corrected all furniture prefabs to be prefab variant

* Added back recklol Dissolve effect (#217)

* Added recklol dissolve effect with some tweaks

* Added names to dissolve outputs

* Added a dissolve effect option in contextual menu and add alpha cutoff in Toon_Disolve

* [Bot] Automated dotnet-format update

* Imported Smurjo's models, reorganised folders

* Hotfix for null checking `ToState`. (#244)

* Wiki and Readme images

* Update README.md

* Update README.md

* Initial decoupling of CameraManager and SpawnSystem. Spawn system still needs reference to CameraManager, because it must provide it to Protagonist.

* Updated prefabs

* Added description to EventChannels

* Introduced RuntimeAnchors

Used in Spawn and CameraSystem for decoupling purposes

* [Bot] Automated dotnet-format update

* Changed the wait to EndOfFrame

Co-authored-by: Smurjo <Johanna@johanland.de>
Co-authored-by: treivize <42570903+treivize@users.noreply.github.com>
Co-authored-by: Ciro Continisio <ciro@unity3d.com>
Co-authored-by: Dave Rodriguez <drod7425@gmail.com>
Co-authored-by: David Lischinsky <david.lischinsky@outlook.com>
Co-authored-by: Jan Urbanec <UrbanecJ@seznam.cz>
DeivSky added a commit to DeivSky/open-project-1 that referenced this issue Jan 7, 2021
* moved inventory scripts to align with project conventions

* actually destroy the gameobject an not the component

* added a background color to the item type

* created player inventory and first ingredient which can be collected

* make it possible to show items of inventory in inspector

* made Item fields as they were before

* hair color mask material, old lady hairdo and glass, moustache, and shell bowl

Various art assets to make the townsfolk more unique. Bowl made from a giant shell.

* Added trap to small testing ground

Useful for testing

* Fix for issue Location Loader issue UnityTechnologies#229

* Revert "Fix for issue Location Loader issue UnityTechnologies#229"

This reverts commit c7d75ff.

* Proposed fix for issue UnityTechnologies#229 with test scenes

* Revert "Proposed fix for issue UnityTechnologies#229 with test scenes"

This reverts commit 14a6a3a.

* Revert "Revert "Proposed fix for issue UnityTechnologies#229 with test scenes""

This reverts commit 3e9fb2d.

* Update Beach Scene with test data

* Revert "Update Beach Scene with test data"

This reverts commit 90ac457.

* Updated Beach Scene with test data for Scene Loader

* Update TestingGround_Small.unity

Grouped object

* Remove Fresnel properties from ToonShading subgraph

I moved Albedo out from ToonShading and into the main shadergraph. I then created the new subgraph Albedo_Fresnel which contains the lerp operation needed for the slimes. The Albedo subgraph has been added to all toon shadergraph variants.

* Fix Plant Critter mesh scaling and name (UnityTechnologies#239)

* Townsfolk_M animations, Palm2

* Added Event that takes GameObject in parameter

* Added events for pickup, cook and talk

* Added interaction example scene

* Added interaction manager script

* Added interaction to main character prefab

* Added Rigidbody component to the Interaction GO on the pig

* Changed interaction key to E (From K)

* Moved Interaction script to scripts folder

* Added tags for interactions

* Added examples to interaction example scene

* Game input update after interaction key change

* [Bot] Automated dotnet-format update

* Remove Albedo Influence on Specular Light Brightness

Swapping the order of the multiply and add nodes in the ToonShading subgraph to multiply albedo by diffuse light alone, then add specular highlights.

Along with this is the need ability to control specular light transparency, which can now be done using the Specular Color property's alpha channel.

* New tree type

* Reset HasBeenPrewarmed (UnityTechnologies#243)

* [WIP] Added some table furniture (UnityTechnologies#233)

* Added some table furnitures

* Corrected all furniture prefabs to be prefab variant

* Added back recklol Dissolve effect (UnityTechnologies#217)

* Added recklol dissolve effect with some tweaks

* Added names to dissolve outputs

* Added a dissolve effect option in contextual menu and add alpha cutoff in Toon_Disolve

* [Bot] Automated dotnet-format update

* updated interaction manager

* interaction ui event

* [Bot] Automated dotnet-format update

* Imported Smurjo's models, reorganised folders

* Hotfix for null checking `ToState`. (UnityTechnologies#244)

* Wiki and Readme images

* Update README.md

* TownAssets

More enviroment 3D assets.
-Small house in the same style.
-Empty market stands
-Small market items for decoration
-A door.

* Added interaction UI when interaction ends

* Update README.md

* Added enable UI action map from InputReader

* Updates on interaction manager

* Interaction go on the pig is now a prefab

* Added pick up sfx and play sound action

* Added pick up state to the state machine

* pickUp state in states folder

* Added item event type

* Added dialogue event type

* removed comment from Interaction UI event channel

* Added interaction events and updated interaction manager

* pushing interaction example scene

* Added isPickingUp SO condition to state machine

* Added pickup state to state machine

* Added timer pick animation condition and is picking up condition

* Added pick up trigger action to state machine

* updated pig chef animator controller for pick up animation

* [Bot] Automated dotnet-format update

* start talking interaction event name updated

* Initial decoupling of CameraManager and SpawnSystem. Spawn system still needs reference to CameraManager, because it must provide it to Protagonist.

* Updated prefabs

* Added description to EventChannels

* Introduced RuntimeAnchors

Used in Spawn and CameraSystem for decoupling purposes

* [Bot] Automated dotnet-format update

* Added Frying Pan asset (UnityTechnologies#252)

* Added Frying pan assets

* Changed material smothness

* Updated furnishing texture and colliders on furniture (UnityTechnologies#251)

* Issue UnityTechnologies#245 simple fix for camera erratic behaviour (UnityTechnologies#250)

* hair color mask material, old lady hairdo and glass, moustache, and shell bowl

Various art assets to make the townsfolk more unique. Bowl made from a giant shell.

* Fix Plant Critter mesh scaling and name (UnityTechnologies#239)

* Townsfolk_M animations, Palm2

* New tree type

* simple fix for camera

* Reset HasBeenPrewarmed (UnityTechnologies#243)

* [WIP] Added some table furniture (UnityTechnologies#233)

* Added some table furnitures

* Corrected all furniture prefabs to be prefab variant

* Added back recklol Dissolve effect (UnityTechnologies#217)

* Added recklol dissolve effect with some tweaks

* Added names to dissolve outputs

* Added a dissolve effect option in contextual menu and add alpha cutoff in Toon_Disolve

* [Bot] Automated dotnet-format update

* Imported Smurjo's models, reorganised folders

* Hotfix for null checking `ToState`. (UnityTechnologies#244)

* Wiki and Readme images

* Update README.md

* Update README.md

* Initial decoupling of CameraManager and SpawnSystem. Spawn system still needs reference to CameraManager, because it must provide it to Protagonist.

* Updated prefabs

* Added description to EventChannels

* Introduced RuntimeAnchors

Used in Spawn and CameraSystem for decoupling purposes

* [Bot] Automated dotnet-format update

* Changed the wait to EndOfFrame

Co-authored-by: Smurjo <Johanna@johanland.de>
Co-authored-by: treivize <42570903+treivize@users.noreply.github.com>
Co-authored-by: Ciro Continisio <ciro@unity3d.com>
Co-authored-by: Dave Rodriguez <drod7425@gmail.com>
Co-authored-by: David Lischinsky <david.lischinsky@outlook.com>
Co-authored-by: Jan Urbanec <UrbanecJ@seznam.cz>

* State Machine - Proposed fix for Issue 228 (UnityTechnologies#227)

* Added Sliding to JumpAscending

Player was unable to jump if sliding which caused the player to get stuck in geometry/holes.

* Added IsActuallyMoving Condition SO and update PigChef Transition Table

IsActuallyMovingSO evaluates character movement by the character controller's velosity.sqrMagnitude. Returns true if the character controller is moving beyond the threshold. Characters can no longer jump while sliding but can jump if they get stuck.

* Update .gitignore

* Small fixes

Reconnected disconnected assets in the TransitionTable, reverted changes on the .gitignore, added multiplication in threshold verification equation

Co-authored-by: Ciro Continisio <ciro@unity3d.com>

* [Bot] Automated dotnet-format update

* Shader tweaks and reorganisation

* Shading style wiki images

* Add files via upload

* Add UI system, Inventory UI and update Inventory System

* [Bot] Automated dotnet-format update

* Fixes to example, moved files in Examples folder

* [Bot] Automated dotnet-format update

* Switched layers of occluding objects

* Leftover lightmaps

* Relocated stray assets

* post merge fixes

* Fixed event for interaction pick up

* Changed Events to Event Channels

* [Bot] Automated dotnet-format update

* added null check before event raise on interaction

* [Bot] Automated dotnet-format update

* bard hare in interaction example scene for talk interaction test

* Adding interaction UI + Events

* Fix last commit

* [Bot] Automated dotnet-format update

* updated event name for interaction ended

* Adding initialization script

* [Bot] Automated dotnet-format update

* Add an on Interaction Ended Event raise

* [Bot] Automated dotnet-format update

* Added collider on bard hare prefab

* updated example scene for interaction

* testing ground scene cleaning

* Imported ground textures

* New FryKing animations and prefab

* Renamed UI scene to gameplay scene

* Removed old comments from InteractionManager

* First setup

* Small fixes

* ChefHat accessory

* palm leaf set and lobster

Prefabs for the cooking festival

* New art assets

* setup IK for the pig on the arms

* Added small internal cooldown to the PlayLandParticlesAction StateAction (UnityTechnologies#260)

* Added small internal cooldown to PlayLandParticlesAction StateAction

https://open.codecks.io/unity-open-project-1/decks/15-code/card/18k-avoid-spamming-particles-on-sliding

Whenever the PlayLandParticlesAction StateAction is exited by the state machine, it checks if total elapsed time is greater then the total elapsed time of the last particle call + a small amount.

If so, only then do we tell the DustParticle Controller to play, and we also set the new time to beat to be the current time.

* Update PlayLandParticlesActionSO.cs

Removed the unnecessarily verbose extra function

Co-authored-by: Ciro Continisio <ciro@unity3d.com>

* [Bot] Automated dotnet-format update

* Fix/LocationSO not serialized properly (UnityTechnologies#258)

* Fix GameSceneSO not serialized properly.

* Add a reference to the script as a ObjectField in the GameSceneSO

To edit the code faster

* Fix typo

* Renaming and cleaning folders

* clening assets folder

* Add control over cooking when near pot

* [Bot] Automated dotnet-format update

* Added new interaction scene example

* Skybox experiments

* ClearSky skybox

* Reworked the CM camera, added collider, noise

* Reorganised scenes

* Removes spaces in scene names

* Bushes, new Fern plant

* Reintroduced camera noise

* Update ReplaceTool.cs (UnityTechnologies#221)

* "Replace" context-menu with a searchable popup  (UnityTechnologies#223)

* "Replace" context-menu with a popup window

* [Bot] Automated dotnet-format update

* Selection interactive preview

* Whoops, wrong merge resolve

* [Bot] Automated dotnet-format update

* Show popup at screen mouse position

* Mini-previews on renderable objects + minor GUI improvements

* [Bot] Automated dotnet-format update

* Editors cache fix, remove dummy editor

* Destroy only cached editor

* Rename "ReplacePrefabTreeView" to "PrefabSelectionTreeView"

* catch ClearPreviewCache error

* fix null texture warning

* Fix popup fit on smaller screens

* Fix black frame when closing popup during repaint

* Expand folder on single-click

* Remove editor Destroy, as error is still showing inside try catch

* Revert delayed close, as it made popup not-closable in some cases

* Added editor for ScriptableObject with events. It allows to automatically show buttons for each event and raise them. (UnityTechnologies#256)

* "Editor window to quickly open scenes" task (UnityTechnologies#267)

* Added the Quick Scene Access Tool

* removed unused file

* [Bot] Automated dotnet-format update

* Imported lobster, palm leaf set, tavern owner's hair

* AnimationRigging setup, lantern grab clip

* Added BardHare and FryKing animations

* Added Run and Faint animation for PigChef, implemented Run as BlendTree

* Removed Localisation samples

* Added the ability to run for keyboard players

* Input and Camera tweaking

* Input and Camera tweaking

* [Bot] Automated dotnet-format update

Co-authored-by: circa94 <hannesklose@hotmail.de>
Co-authored-by: Chema Damak <chema.damak@unity3D.com>
Co-authored-by: Llaczky <72225106+Llaczky@users.noreply.github.com>
Co-authored-by: Smurjo <Johanna@johanland.de>
Co-authored-by: jandd661 <74697341+jandd661@users.noreply.github.com>
Co-authored-by: Dane Byrd <daneobyrd@gmail.com>
Co-authored-by: treivize <42570903+treivize@users.noreply.github.com>
Co-authored-by: Ciro Continisio <ciro@unity3d.com>
Co-authored-by: Amel Negra <amel.negra@unity3d.com>
Co-authored-by: Dave Rodriguez <drod7425@gmail.com>
Co-authored-by: Jan Urbanec <UrbanecJ@seznam.cz>
Co-authored-by: erizzoalbuquerque <erizzoalbuquerque@gmail.com>
Co-authored-by: Erik Behar <invadererik@gmail.com>
Co-authored-by: John McAllister <jandd661@gmail.com>
Co-authored-by: Smurjo <73852662+Smurjo@users.noreply.github.com>
Co-authored-by: MTrecozzi <47111522+MTrecozzi@users.noreply.github.com>
Co-authored-by: Rainaldi Satria <57592497+rainaldisatria@users.noreply.github.com>
Co-authored-by: uChema <59874519+uChema@users.noreply.github.com>
Co-authored-by: juicedup12 <37230501+juicedup12@users.noreply.github.com>
Co-authored-by: Neonage <alexander.neonage@gmail.com>
Co-authored-by: Can Chen <canchen@usc.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (important) This needs to be fixed before shipping, but not as a first priority
Projects
None yet
7 participants