0 votes

[Solved trying to delete this post]

inputEvent is InnputEventMouseMotion eventMouseMotion

the Mouse's relative variable is stored in eventMouseMotion not inputEvent

[]
Hi All, I can't seem to access the variable "Relative" in an InputEventMouseMotion

Things I've tried:

  • Casting the inputEvent to InputEventMouseMotion
  • inputEvent.GetType() returns "Godot.InputEventMouseMotion"
  • inputEvent.GetType().GetFields() - returns an Empty array
  • different iterations of "Relative" (relative, Relative, GetRelative())

Code: (I Could not figure out how to properly format my code)
https://pastebin.com/KT2zEUM6

Thanks,
(will keep searching) - currently trying to print out all variables and methods of the object.

in Engine by (12 points)

1 Answer

0 votes

Untested, but...

public override void _UnhandledInput (InputEvent ev) {
    if (ev is InputEventMouseMotion) {
        InputEventMouseMotion m = (InputEventMouseMotion) ev;
        // here, you can reference "m.Relative.x"... 
    }
}
by (10,916 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.