0 votes

I have a player of type kinematicbody 3D and I want him to be able to pick up a lamp of type starticbody3d with an area node attached how do I make my player pick it up and parent the lamp to him so it goes wherever the player goes

in Engine by (163 points)

1 Answer

+1 vote

Connect the StaticBody signal input_event (or of the Area if you want a different shape otherwise you don't need a Area) to a script:

func _on_StaticBody_input_event(camera, event, click_position, click_normal, shape_idx):
    if event is InputEventMouseButton and event.pressed:
        var static_body = $StaticBody
        # optionally adjust the position
by (4,221 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 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.