0 votes

I know it's a very basic question but I really can't find any documentation online that helps me (I don't know if I'm just stupid and can't find it)

When I try:

extends RigidBody

if translation(Vector3[1]) < -25:
translation(Vector3(0, 0.848, 0))


extends RigidBody

var num = translation(Vector3[1])

if num < -25:
translation(Vector3(0, 0.848, 0))

I have also tried swapping [1] for (y) but that doesn't work either.

They give the error message: Parser Error: Error parsing expression, misplaced: Built-in Type

I don't know if it's just not the correct syntax or maybe you simply cant use it in an if statement.


Godot version 3.2.3
in Engine by (12 points)

1 Answer

0 votes

You could do something like:

extends RigidBody

if translation.y < -25:
     translation.y = 0.848

I hope this helps, and if not I can try to answer any more questions you have.

by (584 points)

That worked! I was pretty sure I tried that already but apparently not. Thanks for the help.

Yup, I’m glad it worked!

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 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 webmaster@godotengine.org with your username.