0 votes

I have been working on a VR game and was trying to allow the player to pick up blocks. I looked at the documentation and found it too be very complex and was hoping to make a simpler solution. However, for the life of me I cannot figure out how to spawn in an object in 3D

Here is my code

func _on_Grab_area_entered(area):
        var currentobject = null
        object = area.name
        var heldobject = load("res://" + object + ".tscn")
        var heldobject = load("res://Box.tscn")
        currentobject = heldobject.instance()
        currentobject.translation = $Position3D

The problem happens with "currentobject.translation = $Position3D" I can't figure out what to use instead of Translation as Position doesn't work either. Something that might be helpful is that the object I'm trying to spawn is a Area, I had wanted it to be a Rigidbody but changed it to hopefully fix the problem.


Godot version 3.2
in Engine by (127 points)

1 Answer

0 votes
Best answer


currentobject.translation = $Position3D


currentobject.global_transform.origin = $Position3D.global_transform.origin


currentobject.translation = $Position3D.translation
by (6,878 points)
selected by

Thank you, the first one worked :D

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.