[Solved] Physics 2.0 Fixed rotation of image, parenting, linked objects


#1

I am busy with my already third project now in Gdevelop (gotta love the engine) and wanted to create something with physics 2.0. I have made some transparent marbles and want them to behave like that. When fixed rotation is off the image should always stay upright. How can I make that the image is detached from the behavior so to speak. In this case when they rotate the illusion of the marble is gone because the lighting in the picture rotates too (see image).

Could i use two circles and attach them to each other whereby one is fixed and the other is able to rotate for example? I tried with a revolute joint but it did not work or I am doing obviously something wrong… Any help is greatly appreciated as I can not seem to figure this one out so quickly.


#2

Marbles have a plain color, and the light effect on it have always the same direction because it’s an light effect, there is no rotation on this kind of light reflexion.
Physics 2.0 don’t need the rotation for compute the collisions.
Is really important to have a free rotation on marbles?

If you really need it, see the project example for linked objects. I think there is a thing about it on the wiki too.


#3

Exactly my point indeed.

It does because else friction will not have the circles roll over eachother and they stack up in a neat line at the edge of the screen until they are completely at the top. It does not look natural. There is a clear difference between the rotation fixed and not fixed.

That was really good referral. Unfortunately I can not seem to get it to work. When i create a second ball and a second sprite to attach it to it, it will attach the sprite to the first ball again. I tried all kinds of tricks to see if it would solve it For example a condition that a object variable should be the same they both have and then do the link object but it remains the same. problem.

It really would look better if rotation is not fixed because it would look far more natural as if they are truly marbles.
this is one of the tries. I use a boolean to make sure the two are linked but the result is that the yellow sprite only links to the first one.
The very light blue ball should also get yellow overlay.


#4

Ok so, open the “Pin object to another multiple parents” project, and remove the line in the red frame, you will get an object linked to another one, and with a fixed orientation.


#5

YES. You are the one. Absolutely fantastic. Thank you so much. I was close with the repeat before but I did not take in account all linked objects (now it makes sense to me). This is the solution indeed. Thank you very very much. I have learned a lot from this.

Cheers!