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

0 votes

Hi all,

I am in trouble again with my connected rigid bodies :)!

I want to flip a node horizontally, which contains 2 bodies and 1 pin joint.
The new positions and directions are correct now, but something is wrong with the joint.

The gravity scale properties are 0, and the bodies don't move (this is OK), but after flipping, they start to rotate... I don't know why :(.

If the joint's nodeA and nodeB members are empty, everything looks good.

I have tried to clear nodeA and nodeB, and restore them at the end of my flip method, but it didn't help...

It's hard to explain, so I uploaded the sample project!
Link: google drive

The flip function is called when a mouse button is pressed.

There are no visible items in the project, so you have to turn on the "visible collision shapes" checkbox!
enter image description here

The clearJointNodes() and setJointNodes() function calls are commented now (root.gd: line 21 and 41).

Thanks for any help / suggestion!

in Engine by (685 points)
edited by

I don't know about your project, but setting the position and scaling are two things RigidBodies usually don't like...

I don't scale the rigid body, only its child collision polygon. According to (the best answer) of my previous topic
But yes, I modify its position (with set_pos function). Is this a mistake?

There is a download link (google drive) to the simplified project, can you check it?

Thank you!

If I do these steps manually in the editor, evereything works fine ... :/

Is there any way to dump an object (print all of the current member values)?
I would like to compare the 2 results (editor vs. script)!

Note that you can't modify CollisionShape nodes from a script (in Godot 2 specifically), because these nodes are only meant to be used in the editor. To change shapes you have to use CollisionObject functions http://docs.godotengine.org/en/stable/classes/class_collisionobject.html#class-collisionobject

Well,

I think there is some problem with collision of these rigidBodies.
Change the collision mask and layer for any of the rigidBodies.
and it will run fine.

May be this will help

Please log in or register to answer this question.

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.