How to do a hang object?

I have no idea about how can i do a hang object, something like a rock hanging on by a rope?
Do anyone knows how to do this?

It is possible. Do you want the rope to be ridged or be like a rubber band? Can you describe whole kind of effect you want?

1 Like

Box2d can do this, or is it not implemented?

1 Like

Sorry. Defold does not support constraints, no.

1 Like

I want to do something like the picture, a rock linked with a rope… but i don’t know how ‘link’ a object rock to another object ‘rope’.

Do you know how to do this?

Do you want it to be part of a physics simulation, be able to interact with other objects? Do you want it to be just an animation? Do you want user input to be able to impact it? Do you want the rope to always look tight or loose? Lots of questions need specific answers first.

Spine model & IK constraint ?

This could work depending on what he wants to ultimately have possible. There are some issues such as Spine’s limit of 2 bones per IK which require some parenting and blending to make work well for longer chains.

Yes, actually predefined animations should work well for situation on the image above. For more generic approach I would try to mix 1-2 bones with IK on the end of the rope with predefined bouncing animations for the rest of the bone chain.
@jhonatanvinicius You can link object to spine model bone, see Defold documentation of spine.get_go function.

1 Like

hummm Ok… lets draw.

I want to do this:

So…

Yes, The rock and rope will interact with others object … but they are distinct object.

NOpe.

Yes, i want.

Yes and no… haha. If rope object and rock object are ‘linked each other’… if i pull the rope the rock must go up together. if i release the rope… both objects must fall down…

So… Do you know how we can ‘fixed’ one object to another?

Does it have to be a rope, or could it be something like a chain link?

Box2D supports physics joints, but unfortunately we do not expose that part of the engine to Lua. I started playing around with my own kinematic physics simulation including joints. I had intended to implement rope joints, but it ended up as spring joints:

You should be able to read up on 2D physics and physics joints and create something similar. I will probably share my project once I’ve worked a bit more on it, but for now it’s too ugly to share :slight_smile:

14 Likes

It would be nice to have joints and an ability to manipulate bones this way.

4 Likes

oh no!.. bad news to me… This is the principal function to my next game… but ok… i will think about one way to bypass this problem… Thanks alot guys.

You can implement the joints yourself, and if you put up certain restrictions it can be fairly simple. I will try to tidy up my own system and share it.

9 Likes

Hi,
I have an idea of a game, where a character swings on a rope. I need to implement a rope. I really need joints to do this.
If Defold has some other alternatives or best practice, please let me know.
Thank you

@britzl I will really appreciate if you share your example with rope

2 Likes