Is it possible to make physics sprites stick together?

Discussion and feedback on Construct 2

Post » Wed Mar 01, 2017 1:35 am

Is it possible to make a game like Rovercraft, Bad Piggies, Reassembly and other similar games where you have multiple sprites co-operating as a single physics object? And if not, why is this not possible in construct 2 but possible in other game engines?
B
27
S
12
G
5
Posts: 79
Reputation: 5,223

Post » Wed Mar 01, 2017 3:33 am

You can create those kinds of physics games on C2 but using physics is a more advanced game design technique and you need some background in physics math to make it all work and it takes practice working with the physics commands.

Start working with the physics behaviors and you will find they can do some very amazing things.

I have made several games using physics and nothing as complicated as some of those but the more you create using physics the better you get.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Wed Mar 01, 2017 9:00 am

The general way to connect multiple physics object together is with joints, but they won't give absolute rigid results. The way to do that is merge multiple shapes to one object, but neither the physics or chipmunk behavior provide that capability.
Why? Well the bundled physics is fairly simple what features it provides from the box2d library. With the chipmunk behavior I opted to keep things simpler by just keeping one shape per object because it's more useful in the general case.
Possible solutions could be the just use a physics library directly with JavaScript run with the browser object, or a new physics behavior which just provides access to everything in the library. you'd have to deal with more errors.
B
94
S
33
G
114
Posts: 5,358
Reputation: 73,777

Post » Wed Mar 01, 2017 3:35 pm

A rigid joint is a pin behavior and you can use pins with physics in C2. Rotating joints can be made to stay together but you have to tweak the friction, mass and gravity to make it work. It is all possible in C2 just not that easy if you have not worked with physics math.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Sat Mar 04, 2017 12:10 am

I am looking for the effect that pin has on construct but with it actually working, it is well known that pin and physics don't work together at all and just send objects that come in contact with the pined physics object flying across the layout. I worked with the physics behavior on construct 2 for 4 years and can not replicate the pin behavior on construct 2 with working/non-buggy physics no matter what I do.
B
27
S
12
G
5
Posts: 79
Reputation: 5,223

Post » Sat Mar 04, 2017 12:46 am

MorrisFeldman wrote:I am looking for the effect that pin has on construct but with it actually working, it is well known that pin and physics don't work together at all and just send objects that come in contact with the pined physics object flying across the layout. I worked with the physics behavior on construct 2 for 4 years and can not replicate the pin behavior on construct 2 with working/non-buggy physics no matter what I do.


They only go flying off the screen if you pin a physics object to another physics object.

You can pin non-physics objects to physics objects and in your example those games use a combination of both.

Image

CAPX

https://www.dropbox.com/s/43967wo8do2iegu/Pin%20Joint.capx?dl=0

Those yellow sprites are non physics objects pinned to a physics objects and go ahead and whack them with the physics bat and try to get them to come apart.
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,825

Post » Sat Mar 04, 2017 12:49 am

Yeah, the physics behavior doesn't provide the features to do it.
One idea that would work, and that I'm interested in, is to just deal with a physics library directly with JavaScript. The only disadvantage is it would be completely seperate from the behavior's and how they nicely mesh with c2's features. So everything would have to be done with events. A plugin would be better but that takes a lot more time to make and polish. I'll probably try the idea this weekend and see what comes of it.
B
94
S
33
G
114
Posts: 5,358
Reputation: 73,777

Post » Sat Mar 04, 2017 9:49 am

Another option is to write your own physics engine with events. Using sprites, you could create your own physics rules for collision and object interaction.

A third option is to have your sprites be pinned to invisible physics objects. When two objects collide, the two underlying physics objects could be replaced by a single larger physics object. Just re-pin the two sprites to the larger physics object, and compute the new size of the collider based on the combined size of the two sprites. This might give you a close enough approximation of the behavior you are looking for.
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
51
S
15
G
25
Posts: 424
Reputation: 17,321


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests