0 votes

Hey, I'm trying to create a SpringJoint system for my 2D UFO Grabber-style game in order to apply tension to the claw, and I'm currently trying to achieve this by moving the Spring location to redirect the direction that the claw is currently pointing towards.

enter image description here

Although i'm sure there's other ways I could achieve this, trying to animate the position doesn't work at all - the joint maintains the spring location set from the editor.

Is this a bug or a feature? Does anyone have any other potential solutions for achieving the same effect? (Im considering trying to apply two different springs to the same joint in different directions, that then alter their stiffness to get the claw to rotate).

in Engine by (23 points)

1 Answer

0 votes

It's been my experience that using animation will usually suspend physics bodies and treat the movements as kinematic, until the animation completes. You can see this for yourself if you animate a rigid body.

Without full knowledge of your project, I would venture to say you'll have to manage the motion for these things inside of the fixed_process() or integrate_forces() functions if you want the physics simulations to continue processing.

To answer the question, it's by design that animations and the physics system don't intermingle.

by (5,242 points)

I'd have agreed with that, but when the animation is completed the location of the spring still doesn't change when according to your description it seems like it should be able to. I'm currently using fixedprocess for some animation though and will look into integrateforces() :)

Hmmm yeah, I it is a bit unclear for joints specifically, but they definitely don't animate at all, even though it appears that way in the editor. They can only be moved via script. I haven't tested though how robustly they function however.

The joint and constraint system is functional, but seems a fair bit underdeveloped for the time being.

Seems like it, at least there's some workarounds though - using two springs in different positions and alternating their stiffness creates a similar effect.

Thanks for the response though!

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.