This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

The Error happens on this function and only appears when I left click or in my input map is "fire" that is associated with my grappling gun that is a child of the Player character

func _input(event):
    if event is InputEventMouse: #ERROR HERE
        rotate_y(deg2rad(-1 * event.relative.x) * mouse_sens)
        head.rotate_x(deg2rad(event.relative.y) * mouse_sens)

        # Clamp head x rotation
        head.rotation.x = clamp(head.rotation.x, deg2rad(-90), deg2rad(90))
Godot version v3.4.2.stable.official
in Engine by (12 points)

1 Answer

+1 vote

There are multiple types of InputEventMouse events. A mouse button event doesn't have a relative property, but a motion event does. You're checking all mouse events, and therefore you get this error. Since you seem to only care about motion events, change to

if event is InputEventMouseMotion:
by (22,191 points)

NICE, thank you very much, my friend, it is greatly appreciated although my grappling gun doesn't seem to work so gotta fix that now.

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 Frequently asked questions and 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 [email protected] with your username.