Valheim

Valheim

Siri Feb 16, 2021 @ 8:11pm
Can I change rotate key from scroll mouse to other button?
My scroll mouse is crash. Can I change rotate key from scroll mouse to other button? Or add
rotate key setting to keybinding page.
< >
Showing 1-12 of 12 comments
Fall3n Mar 13, 2021 @ 9:24am 
Same my scroll is broken and I can't rotate things...
Wariat117 Mar 13, 2021 @ 9:27am 
1) You can use controller (just for rotating, and for the rest K+M)
2) You can edit the button in the game files

File:
\Steam\steamapps\common\Valheim\valheim_Data\Managed\assembly_valheim.dll
Class:
public class Player : Humanoid
Method:
private void UpdatePlacement(bool takeInput, float dt)

Code:
if (Input.GetAxis("Mouse ScrollWheel") < 0f) { this.m_placeRotation--; } if (Input.GetAxis("Mouse ScrollWheel") > 0f) { this.m_placeRotation++; }
Either replace those 2 or add next to them
if (Input.GetKey(KeyCode.LeftAlt)) { this.m_placeRotation--; } if (Input.GetKey(KeyCode.RightAlt)) { this.m_placeRotation++; }
Instead of left/right alt you can use different buttons.
Last edited by Wariat117; Mar 13, 2021 @ 9:36am
Fall3n Mar 15, 2021 @ 10:21am 
hi, thanks for your answer. Could you tell me how to edit the file? I didn't find how to do it
Wariat117 Mar 15, 2021 @ 10:28am 
Originally posted by Fall3n:
hi, thanks for your answer. Could you tell me how to edit the file? I didn't find how to do it
i'm using program called "dnSpy"
I have heard that "Visual studio" works too

generally any program that allows to edit C# should do


in dnspy once you find the mentioned method you right click -> edit method
once you do your job you right click -> compile
Last edited by Wariat117; Mar 15, 2021 @ 10:29am
Fall3n Mar 15, 2021 @ 12:16pm 
it's hard to control the rotation but it works and that's the most important. Thank you very much for your help!!
Siri Apr 2, 2021 @ 7:59am 
thank you for your knowledge :D
C4st1gator Jul 31, 2021 @ 8:44am 
Originally posted by Wariat117:
Instead of left/right alt you can use different buttons.

Thank you so much. I don't know why the developers don't want users to be able to rebind the mouse wheel through the user interface, but this will now be my method of choice. Thank you. You saved Valheim for me.
Weaver (Banned) Jul 31, 2021 @ 9:05am 
Add to an existing comment about keybinds in the suggestion forums. Devs, especially small ones often don't think of many things, such as rebinding everything, because it never occurred to their small team. It's like they likely don't have anyone who is coloblind on the team because for us colorblind folks the mushrooms and berries can be bloody invisble as they blend in with everything else. Accessibility options are often things devs don't think about unless it is brought up to them.
Wariat117 Jul 31, 2021 @ 9:48am 
Originally posted by C4st1gator:
Originally posted by Wariat117:
Instead of left/right alt you can use different buttons.

Thank you so much. I don't know why the developers don't want users to be able to rebind the mouse wheel through the user interface, but this will now be my method of choice. Thank you. You saved Valheim for me.
I don't think that unity has easy way to implement this
It looks like buttons and mouse wheel are as different as birds and humans
they are both alive, but you can't really swap them

long story short, it's just pain in the butt and waste of time to make it
small devs usually use what's prepared already by the engine and leave it be while they focus on drinking game
Last edited by Wariat117; Jul 31, 2021 @ 9:48am
C4st1gator Jul 31, 2021 @ 3:07pm 
Granted, I didn't modify Unity Engine, but I have enough experience with GTK 3.0 and QT to say that the button is only a means to fire an event.

This can be done with any other button and mouse wheels really aren't special in this regard. The spinning wheel simply causes a quick succession of wheel-up or wheel-down signals. The game engine has an event loop listener, that executes actions depeding on the input signal.

Besides, Unity Engine also has Cities:Skylines, which was made by 12 people and supported rebinding zoom-in and zoom-out camera controls from day one. I swapped mouse wheel for keyboard wihtout issue there, so it's not impossible.

Looking into its documentation[docs.unity3d.com], Unity seems to support mouse, keyboard and controller input by default. Though they built a SrollHandler class into the engine to handle scroll wheel input. It should be possible to convert the scroll wheel movement into Unity input type.
This article[www.programmersought.com] describes it in some detail. I may look into this more in-depth, but I'd need a way to send the findings to the developers.

Still, I'll probably have to recompile the dll in the short to medium term.
Wariat117 Jul 31, 2021 @ 11:41pm 
Originally posted by C4st1gator:
so it's not impossible.
noone said it's impossible
Originally posted by Wariat117:
it's just pain in the butt and waste of time to make it
it's just waste of time
C4st1gator Aug 1, 2021 @ 3:06pm 
No it's not. Some C# code of the level I can write is certainly not a waste of time, if it makes the game controls better.
< >
Showing 1-12 of 12 comments
Per page: 1530 50

Date Posted: Feb 16, 2021 @ 8:11pm
Posts: 12