The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+1 vote

How does this line of code work?

onready var head = $Head
func physicsprocess(delta):
var headbasis = head.getglobal_transform().basis

Please help

in Engine by (181 points)

1 Answer

0 votes

in the first line you create a variable with the name of "head" that refers to the "Head" node before the scene loads.
in the second line you started the PhysicsProcess(delta) that I'm not sure what it means but what I understand is that it does what's inside it every physics frame.
in the last line you create a variable every physics frame with the name of
"headbasis" that stores the transform(position, rotation, scale) of the head but the basis thing is what I don't understand, I'd like to see the tutorial that you got this code from.
so you basically store the head's transform every physics frame.

by (290 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.