Physics pulley joint

GameMaker Studio developers

Physics pulley joint

In this tutorial we show you the Physics Pulley Joint. Create complex pulley systems, learn how to use its interface and chain objects.

SoloStudio Tech Youtube Channel


1.0 – Creating the physical objects

Let’s start by talking about the previous tutorial, highlighting that if you have not seen the article, it is highly recommended to do so. There we talk about physical objects and all the features that the editor offers us. It is an indispensable material to understand today’s article as the coming ones.

We already know how to create an object and add physical properties. In this case we will create 2 objects, one of them will have assigned meeting data. The other simply acts as a crutch for the union.

1.1 – Assigning a Pulley joint

We select the second object and assign the JOINT PULLEY board.

From this moment, we will click on the virtual SET JOINT button to display our panel of boards showing us the values that we can change.


1.2 – Setting coordinates

We can modify our board in two ways, the first is to use our mouse to position the points where we will fix the pulley. The first CLICK positions the first point.

A second CLICK will position the second pulley.

The second method is by manually placing the values from our panel.

One of the options of this type of joint is that we can adjust the ratio. The proportion of weight between them modifying a single value.

If we place a value of 0.5, the first block will tend to fall. Changing this value to 1, your balance will be fair. And if we set this value to 1.5, the balance tilts towards the second object.

In this case we have placed a RATIO of 1, thus balancing our platforms.

From this moment we can do a simulation test and check that our board works correctly …


1.3 – Adjusting our collision

We return to the editor to make some collision adjustments, from our main physics panel (PHYSICS PROPS) we will subtract five collision units from the collision model (represented by the green stripes). In the coordinate plane of our world, the Y axis is inverted, with position 0.0 being the upper left corner of our map. Therefore, when we mark a -5, our shape moves up.

We also decided to change the type of collision so that our objects have mass, assigning the POLYGON type from the SHAPE TYPE option of our physics panel.

Now we can verify that our platforms react in a correct way based on their density and mass. The player can perch on these creating a balance effect between the two objects. But as you can see, the position of the joints causes the blocks to rotate as if they were hanging by a thread. This is because physics take into account the rotation of objects in the simulation.


1.4 – Physics settings

So that this does not happen, we will go to our physics panel to change the value of FIXED ROTATION to 1.

We do a test again and check that our blocks move through the guides without taking into account the rotation variable.


1.5 – Terrain Settings

Now let’s give as an example that we want to adjust the terrain of one of our blocks. Simply follow the steps described in the terrain-based tutorial and we can obtain different forms in our meetings.

DarkSpine wants you to create games with organic scenarios, making our land compatible with other options offered by the editor.

Up to here it will depend on the user to modify our objects to obtain the desired result. Being able to combine these in any way.


1.6 – Joint settings

From the SET JOINT joint panel, we are allowed to modify the central axis that joins our object with the first point of our joint. We will only have to modify the values from the text boxes.

The configuration of our joints also adjust relatively if we move an object. This means that if after creating a joint, we can rotate an object, their position automatically adjusts locally.

In this way we do not lose the configuration of our boards when modifying an object …

The system allows us to join as many joints as we want to our objects. Whenever we act with logic, we will be able to create complex mechanisms in our game.


Recommendation:

We strongly recommend that you view the video located at the beginning of this article to get a clear idea of this section.

The video tutorials provided on the YouTube channel support subtitle contributions from users. This means that any user can contribute to add subtitles with the editor and the new contribution program of YouTube subscribers.


We conclude this article, in the following tutorials we will continue to discover the types of meetings offered by the tool. I send you my best regards and see you in the next article!

You may also like:

One Response

  1. Matemáticamenteincorrecta says:

    👏👏👏👏👏👏👏👏👏👏

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.