#Invalid set index 'velocity' (on base: 'RigidBody2d (Bagel)' with value of type 'Vector2'

8 messages · Page 1 of 1 (latest)

north juniper
#

Hi folks, I'm trying to make it so that when the object (bagel) tries to hit a trap (poop) it will reset the position back to the start (where the marker 2d is named SpawnPosition). However, I'm getting this error as soon as it hits the poop:

Invalid set index 'velocity' (on base: 'RigidBody2d (Bagel)' with value of type 'Vector2' Including scripts in screenshots, along with the node structures for each item affected:

unique orbit
#

I am not sure RigidBody has velocity. I know it has angular_velocity and linear_velocity

#

Check the docs

north juniper
#

Thank you! I’ll check it out later 🙂

north juniper
#

Okay I tried changing the code in the level.gd to bagel.linear_velocity = Vector2.ZERO and now it halts the object when it hits the trap and I see a glitch where it flicks the start of the stage for a microsecond. Doesn't crash the game or anything.

north juniper
unique orbit
#

do you have any logic resetting the position of the camera that might be being called in that frame?

north juniper
#

Oh cripes, I did not! 😦 I might check the course code and see if there's anything about that too.