0 votes

I add my enemy with this in my game world:

var enemyscene = load("res://Enemy/Enemy.tscn")
var enemy = enemyscene.instance()

He spawns in the middle of the world scene (at (0|0|0)). Is there a way so set the position?
enemy.position.x = 10, etc. doesn't work for a 3D Kinematic Body.

in Engine by (142 points)

1 Answer

+1 vote

you can type:
enemy.global_position = (x, y, z)

by (291 points)
edited by

If I type in e.g.:

enemy.global_position = (10, 10, 10)

It says:

Expected ')' in expression

But I can do

enemy.global_transform.origin.x = 10


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.