Clickteam Fusion 2.5

Clickteam Fusion 2.5

38 ratings
A Quick Intro to Physics
By DannyUK2k14
Welcome to this introductory guide on inserting Physics objects and applying some of the available conditions, actions and events in Fusion 2.5.

This is not an exhaustive Physics guide, just an introductory guide to get you on your way around the physics objects in Fusion 2.5.
   
Award
Favorite
Favorited
Unfavorite
Introduction
Welcome to this introductory guide on inserting Physics objects and applying some of the available conditions, actions and events in Fusion 2.5.

This is not an exhaustive Physics guide, just an introductory guide to get you on your way around the physics objects in Fusion 2.5.

Fusion 2.5 has a lot of focus around the Physics Objects and rightly so. The physics engine (Box2D) has been almost built-in to the main Fusion 2.5 runtime. This is great news for enthusiasts and professionals alike. It now means you can introduce Physics into your game concepts and export them across all platforms.

The bonus advantage to using Physics based movements and concepts is; there is now a whole world of new types of games you can create, the possibilities are almost endless.

Whether you want to create the next Angry Birds-like game or whether you want to create something unique in the game world, now is your chance with the Physics Engine and Fusion 2.5!
The Physics Engine
The Physics - Engine object is the driving force behind your physics-based applications. It contains the code necessary to make the objects to move in a physical-oriented way. This object must be present in the frame if you use one of the physics-driven movements. This object also contains a number of actions to control and affect the objects of your physical world.

Without the Physics Engine object inside your frame, physics movements will not be available.

With the Physics Engine object, you can control the entire world inside your frame. You can set, modify and adapt gravity strength, gravity angle, set object properties such as friction, density, elasticity and gravity scales applied to each individual object.

The Physics Engine also allows you to use Standard Fusion movements too, so for example if you have an enemy that just walks left and right on a platform, you can allow the engine to incorporate this into the physics world so anything it touches, it will interact with.

You can create 'joints' where objects are joined in some way, shape or form. Whether it's in the form of a Distance Joint, Revolute Joint or a Prismatic Joint.

As with most extensions, you can also retrieve a number of real-time expressions, such as current gravity strength, damping, object velocities and much, much more. We will cover all of this in future guides and examples but for now, let's move on to some basic objects and applying some basic physics routines in an example.
Using the Built-In Physics Movements
Ok, so as explained above in Step 2, you will need to drop in the Physics Engine object somewhere in or outside of your frame. Let's do this by inserting a new object into the playarea. Go to Insert > New Object, select the Physics Object and put it just outside of your playarea.


Once you have done that, let's insert an active object. Let's insert a new active object and let's create a box (32x32) like so...


Once you have done this, don't forget to click on the Hotspot Icon (eye) and click on 'G'. This will automatically centre the hotspot at the centre of mass. Not necessarily the centre of the image, the centre of the mass of the object. Fusion 2.5 neatly does this automatically for you by just clicking 'G' inside the picture editor.

Now we need to create some kind of 'ground' for our box to land on. So let's insert another object. This time a Quick Backdrop object. Stretch it so that it fits our playrea and maybe put a border on it.


Once you are happy with your bit of 'ground', right click on the object and select Create > Active Object.


Once done, you can delete the quick backdrop and position your new ground active object at the bottom of the frame. Don't forget to edit the Ground Active Object and set it's hotspot position to 'G'. Now we need to setup some properties for our box and ground so let's do that next.

So, we have our 'ground' in position and we have our 'box' ready to go. Let's setup the properties of these two objects so we can tell our physics engine which is the box and which is the ground and how they should behave in the physics world.

Let's do the floor first. Click on the floor active object and go to the properties box. Click on the Movement tab and in the movement type select: Physics – Background.


This will present you with some additional properties you can configure. You can leave everything as it is, except change Obstacle to Obstacle and change Collision Shape to 'Box'. Now let's move onto our box. Click on the box we created and go to the movement tab, select the Physics – Static Movement type.

You can pretty much leave it all as it is for now (you can play with the additional properties later) but for now, change Collision Shape to 'Box' and select 'Smooth Rotations'.


So that is pretty much our 'physics world' setup and we haven't even wrote a single event, expression or line of code yet. That's how easy things are in Fusion 2.5. Now if you Hit F8 to run the game, you will see everything automatically starts working like it would in a physics world, the box moves downwards towards gravity but it drops straight passed the 'ground' active object we created.

Let's hop over to the next page and start working some magic!
Applying some basic Physics via the Event Editor
Ok, so for the sake of this guide, we're not going to create a 'game' per-se; we're going to create a kind of testbed to get you settled with Physics in Fusion 2.5. Click on the Box object, select the Runtime Tab and uncheck 'Create at Start'. We're doing this because we don't want Fusion to create the box object at the start, we want to create it ourself, from the event editor. We're going to create a simulation of boxes falling from the sky. Let's head over to the Event Editor.

Let's create a new condition. Right click on the Keyboard & Mouse object and select The Mouse > User Clicks. In the prompt dialog, choose Left Mouse.


Once you've inserted this condition, hover over to the 'Create Object' icon, right-click and select Create Object.


Click on the 'Box' object and click OK.


Fusion will then ask you where you want to create the object. Select anywhere for now, it doesn't matter because in the next action we will tell the object to instantly move to where the mouse is. So in effect, our object is going to be created wherever we click. Once you've clicked OK, then on the same condition line, hover over to the box, right-click and select Position > Set X Co-ordinate.


When prompted with the expression editor, type in 'Xmouse' and click Okay. Repeat for the Y Co-ordinate and use 'Ymouse' in the expression editor. Once you've done that, save your file and run the application. You should now be able to click anywhere on the screen and create a box.

So we can now create boxes and as many as we want just by left-clicking anywhere in the frame, very nice. Now, our box is still dropping straight through our 'Ground' object we laid earlier. This is because you need to tell Fusion 2.5 what to do when certain objects collide with other objects. So, let's create a new condition. Select the Box object, right-click and select Collision > Backdrop.


Once you've inserted this condition, hover over to the Box object, right-click and select Movement > Stop.


Now, just a note. This does NOT imply 'stopping' the object (speed wise). You are telling Fusion here, if the box collides with the ground stop the box at the collision point, not decelerate. Gravity is always being applied and depending on what angle the box collides with the ground, it could still be moving. However, with the way we have our flat surfaces laid out, this shouldn't be an issue for the moment.

Hit F8 and run your application, start creating some boxes and notice how they now stop when they make contact with the ground. But the boxes are falling through each other?

Again, we need to tell Fusion about this. We need to say when a Box collides with another Box, stop the movement. This will stop the objects from overlapping each other.

So, let's create another condition. If Box collides with Box, Movement > Stop.


Once you've done this, hit F8 and run the application again. Now create lots of boxes in lots of different areas of the frame and watch the magic come together. We have created this in literally, 3 events and just 5 actions.

You can now have a play about inserting more objects, such as balls and applying Circles to the Collision Shape in the object properties and much, much more.

Do drop in some of the other Physics objects (extensions) available in the extension manager. All of them come with available help files and examples in the Fusion 2.5 folder.

7 Comments
Nonos 17 Aug, 2020 @ 11:21am 
Good job copying the official CTF tutorial!
ℬüḓḓнїṧт_Gamer7☸ 28 Jun, 2015 @ 8:40am 
why re- do a guide that is already in the software?
dantman17 20 Jun, 2015 @ 8:20pm 
Very nice! Keep up the good work!
Duck!{Mutenjoyer} 29 Jun, 2014 @ 10:20am 
Very good guide helped my alot, but I have just one question for some reason when I made the ground just half of the ground acts as an obstacle, do you know why?
Dwigt 27 Jun, 2014 @ 12:14pm 
Thank you! Clear instruction and I learned what I wanted. Keep posting!
Powertrip 22 Mar, 2014 @ 7:53pm 
pretty good :)
MattMcD 23 Dec, 2013 @ 6:57pm 
Thanks for this. It was a great introduction for adding physics.