Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gdevelop5:behaviors:physics2 [2020/12/26 13:56] 127.0.0.1 external edit |
gdevelop5:behaviors:physics2 [2021/03/03 21:09] (current) victrisgames [Revolute Joint] |
||
---|---|---|---|
Line 1: | Line 1: | ||
#Physics Engine 2.0 | #Physics Engine 2.0 | ||
- | The Physics behavior | + | You can add Physics behavior to objects to make them move realistically, following the laws of physics. |
\\ | \\ | ||
- | The behavior is composed of three big concepts: the world that hold the bodies, the bodies | + | The behavior is composed of three big concepts: the world that hold the bodies, the bodies |
\\ | \\ | ||
- | <note important> | + | <note important> |
##World | ##World | ||
- | The world is the place where simulations run, bodies and joints are attached to a world so they can interact with other entities.\\ | + | The world is the place where simulations run, bodies and joints are attached to a world to interact with other entities.\\ |
- | You don't have to care about placing objects in the world, objects using the Physics behavior | + | You don't have to care about placing objects in the world, objects using the Physics behavior |
- | World size, like GDevelop scenes size, is infinite, so you don't have to care where your objects are, they' | + | Like GDevelop scenes size, world size is infinite, so you don't have to care where your objects are. They will always follow the laws of physics.\\ |
\\ | \\ | ||
- | The world has 3 properties: | + | The world has three properties: |
- | * **Gravity**: | + | * **Gravity**: |
- | * **Timescale**: | + | * **Timescale**: |
- | * **Scale**: GDevelop distances and sizes are defined in pixels but the physics engine uses meters, to make the conversion a scale factor must be set (again, it has two components, scale X and Y). The scale numbers mean how many pixels a meter is, for example, a scale of 50 means that a distance of 50 pixels in GDevelop is converted to 1 meter in the physics world. | + | * **Scale**: GDevelop distances and sizes are defined in pixels, but the physics engine uses meters. A scale factor must be set (again, it has two components, scale X and Y) to make the conversion. The scale numbers mean how many pixels a meter is; for example, a scale of 50 means that a distance of 50 pixels in GDevelop is converted to 1 meter in the physics world. |
- | < | + | < |
##Bodies | ##Bodies | ||
- | Bodies are the life of the Physics extension, they define how your object will move, what will be its shape, how much it will bounce, | + | Bodies are the life of the Physics extension; they define how your object will move, what its shape will be, how much it will bounce, |
\\ | \\ | ||
- | When you add the Physics behavior to an object you can set the body configuration right from the IDE.\\ | + | When you add the Physics behavior to an object, you can set the body configuration right from the IDE.\\ |
There are many options to play with, so they have been categorized below. | There are many options to play with, so they have been categorized below. | ||
+ | . | ||
###Body Type | ###Body Type | ||
GDevelop supports three basic body types: | GDevelop supports three basic body types: | ||
- | * **Dynamic**: | + | * **Dynamic**: |
- | * **Static**: Static objects are not affected by gravity, and you can't move them using forces, impulses | + | * **Static**: Static objects are not affected by gravity, and you can't move them using forces, impulses |
- | * **Kinematic**: | + | * **Kinematic**: |
And some dynamic-related settings: | And some dynamic-related settings: | ||
- | * **Bullet**: If set to true, the object will use a continuos-collision-detection algorithm, slightly reducing the performance but improving the response when moving very fast. Useful to correctly simulate... well... bullets (or any very fast object), and reduce the chances for the bullets to go through thin objects. | + | * **Bullet**: If set to true, the object will use a continuous-collision-detection algorithm, slightly reducing the performance but improving the response when moving very fast. Useful to correctly simulate... well... bullets (or any high-speed |
- | <note warning> | + | <note warning> |
- | * **Fixed Rotation**: If set to true the object won't be able to rotate. Imagine your player | + | * **Fixed Rotation**: If set to true, the object won't be able to rotate. Imagine your player |
- | * **Can Sleep**: If set to true the engine can improve the performance on objects that haven' | + | * **Can Sleep**: If set to true, the engine can improve the performance on objects that haven' |
- | < | + | < |
###Body Shape | ###Body Shape | ||
Body shape options determine the body form and size, and, depending on the shape type, you have different options to set the dimensions: | Body shape options determine the body form and size, and, depending on the shape type, you have different options to set the dimensions: | ||
- | * **Box**: *An axis-aligned rectangle centered on the object*, if custom width and height are not set, the object size is used. | + | * **Box**: *An axis-aligned rectangle centered on the object*; if custom width and height are not set, the object size is used. |
- | * **Circle**: *A circle centered on the object*, if a custom radius is not set it will be calculated as an average from the object width and height. If the object is in the form of a square, the result will be an inscribed circle inside the object bounding box. | + | * **Circle**: *A circle centered on the object*; if a custom radius is not set, it will be calculated as an average from the object width and height. If the object is in the form of a square, the result will be an inscribed circle inside the object bounding box. |
- | * **Edge**: *A thin line centered in the object*, since this shape has no volume it doesn' | + | * **Edge**: *A thin line centered in the object*; since this shape has no volume, it doesn' |
- | * **Polygon**: | + | * **Polygon**: |
In addition to custom shape type and dimension, the body shape supports two extra options: | In addition to custom shape type and dimension, the body shape supports two extra options: | ||
* **Offset**: The offset has two components (X and Y) and can be used to move the shape from the object center. | * **Offset**: The offset has two components (X and Y) and can be used to move the shape from the object center. | ||
- | * **Scale**: You can scale the shape too. It will scale the shape' | + | * **Scale**: You can scale the shape too. It will scale the shape' |
###Body Settings | ###Body Settings | ||
Besides the type and shape, physics bodies have some extra settings that determine how the body will behave on collision, how the gravity will affect them and the energy they lose by air friction. Each setting is explained below: | Besides the type and shape, physics bodies have some extra settings that determine how the body will behave on collision, how the gravity will affect them and the energy they lose by air friction. Each setting is explained below: | ||
- | * **Density**: | + | * **Density**: |
- | * **Friction**: | + | * **Friction**: |
- | * **Restitution**: | + | * **Restitution**: |
- | * **Linear Damping**: | + | * **Linear Damping**: |
- | * **Angular Damping**: | + | * **Angular Damping**: |
- | * **Gravity Scale**: | + | * **Gravity Scale**: |
< | < | ||
###Layers & Masks | ###Layers & Masks | ||
- | Layers and masks are the way to filter collisions between objects. Imagine you're building a zombies | + | Layers and masks are the way to filter collisions between objects. Imagine you're building a zombie |
How do filters work? | How do filters work? | ||
There is just a single rule: | There is just a single rule: | ||
- | <note important> | + | <note important> |
- | Here is a possible solution to the above zombies | + | Here is a possible solution to the above zombie |
* Ground: Enable the first layer and the first and second masks. | * Ground: Enable the first layer and the first and second masks. | ||
* Player: Enable the first layer and the first and second masks. | * Player: Enable the first layer and the first and second masks. | ||
* Zombie: Enable the second layer and the first mask only. | * Zombie: Enable the second layer and the first mask only. | ||
Why does it work? | Why does it work? | ||
- | * Ground & Player: A ground layer matches a player mask (first) **and** a player layer matches a ground mask (first) | + | * Ground & Player: A ground layer matches a player mask (first), **and** a player layer matches a ground mask (first) |
- | * Ground & Zombie: A ground layer matches a zombie mask (first) **and** a zombie layer matches a ground mask (second) | + | * Ground & Zombie: A ground layer matches a zombie mask (first), **and** a zombie layer matches a ground mask (second) |
- | * Player & Zombie: A player layer matches a zombie mask (first) **and** a zombie layer matches a player mask (second) | + | * Player & Zombie: A player layer matches a zombie mask (first), **and** a zombie layer matches a player mask (second) |
- | * Zombie & Zombie: The zombie has only the second layer enabled, and only the first mask enabled, so zombies can't collide each other. | + | * Zombie & Zombie: The zombie has only the second layer enabled, and only the first mask enabled, so zombies can't collide |
- | Note that you have 16 layers and 16 masks available, and to solve our little problem only 2 layers and masks were needed. | + | Note that you have 16 layers and 16 masks available, and to solve our little problem, only two layers and masks were needed. |
###Movement | ###Movement | ||
- | After setting up your objects it's time to start the simulation: gravity will start to push things, objects will move and collide, but you can't interact with your game at all. It's time to move the objects by yourself and to do that you have to use the events system. Here are some useful actions to interact with the objects and move them in the way you want: | + | After setting up your objects, it's time to start the simulation: gravity will begin to push things, objects will move and collide, but you can't interact with your game at all. It's time to move the objects by yourself, and to do that; you have to use the events system. Here are some useful actions to interact with the objects and move them in the way you want: |
- | <note warning> | + | <note warning> |
- | * **Forces**: Forces change | + | * **Forces**: Forces change an object's movement |
- | __To add a force, an application point must be set.__\\ \\ | + | __An application point must be se to add a force..__\\ \\ |
- | * **Torques**: | + | * **Torques**: |
- | * **Impulses**: | + | * **Impulses**: |
- | __To add an impulse an application point must be set.__\\ \\ | + | __An application point must be set to add an impulse.__\\ \\ |
- | * **Angular Impulses**: | + | * **Angular Impulses**: |
* **Velocity**: | * **Velocity**: | ||
* **Angular Velocity**: You can set the angular velocity (rotation speed) directly too. | * **Angular Velocity**: You can set the angular velocity (rotation speed) directly too. | ||
- | <note important> | + | <note important> |
- | Note that forces and impulses need an application point, it' | + | Note that forces and impulses need an application point; it' |
- | If the application point is different than the object mass center it will generate some kind of torque/ | + | If the application point is different than the object mass center, it will generate some kind of torque/ |
- | < | + | < |
## | ## | ||
Line 113: | Line 115: | ||
**Joint ID**:\\ | **Joint ID**:\\ | ||
- | When you create a joint you can pass a variable name, if you do it GD will store the joint unique identification number (ID) in the given variable. Using the joint ID, you can modify it after the creation, check its values and remove it. Imagine you create a joint to stick a key to a rope attached to the roof, if you save the joint ID in a variable then you can check if an object collides with the rope, and remove the joint using the saved ID to make the key fall down. | + | When you create a joint, you can pass a variable name; if you do it, GD will store the joint unique identification number (ID) in the given variable. Using the joint ID, you can modify it after the creation, check its values and remove it. Imagine you create a joint to stick a key to a rope attached to the roof; if you save the joint ID in a variable, then you can check if an object collides with the rope and remove the joint using the saved ID to make the key fall down. |
< | < | ||
- | Usually, you will need two objects to define a joint (in the previous example the rope and the key), but there are " | + | Usually, you will need two objects to define a joint (in the previous example, the rope and the key), but there are " |
Here is a list of properties, conditions, and actions common for all types of joints: | Here is a list of properties, conditions, and actions common for all types of joints: | ||
* **Joint first/ | * **Joint first/ | ||
* **Joint first/ | * **Joint first/ | ||
- | * **Joint reaction force/ | + | * **Joint reaction force/ |
- | * **Remove joint**: Action to remove the specified joint. If the joint is one of the children of a gear joint the gear will be also removed. If any of the objects the joint is attached to is deleted the joint will be deleted | + | * **Remove joint**: Action to remove the specified joint. If the joint is one of the gear joint children, |
- | There are many kinds of joints, each one with unique behaviors and properties, they are listed below. | + | There are many kinds of joints, each one with unique behaviors and properties; they are listed below. |
- | <note important> | + | <note important> |
###Distance Joint | ###Distance Joint | ||
- | Distance joint tries to keep two objects separated by a given distance, the distance is calculated from the joint anchor points. | + | Distance joint tries to keep two objects separated by a given distance; the distance is calculated from the joint anchor points. |
The objects won't be at the given distance all the time but will tend to reach it, following an oscillator formula. | The objects won't be at the given distance all the time but will tend to reach it, following an oscillator formula. | ||
Settings: | Settings: | ||
- | * **Length**: The target distance, if a negative value is given the distance between the objects | + | * **Length**: The target distance, if a negative value is given, the distance between the objects |
* **Damping ratio**: The " | * **Damping ratio**: The " | ||
- | * **Frequency**: | + | * **Frequency**: |
- | < | + | < |
###Revolute Joint | ###Revolute Joint | ||
- | Revolute joints work like " | + | Revolute joints work like " |
- | There are two types of revolute joints, in the end, they are almost the same, with a small difference: | + | There are two types of revolute joints; in the end, they are almost the same, with a small difference: |
- | * **Revolute | + | * **A revolute |
- | * **Revolute | + | * **A revolute |
- | < | + | < |
Here is the list of the settings specific for revolute joints: | Here is the list of the settings specific for revolute joints: | ||
- | * **Angle limits**: If enabled the rotation will be restricted between the minimum and maximum angles. Note that both angles are relative to the first object. | + | * **Angle limits**: If enabled, the rotation will be restricted between the minimum and maximum angles. Note that both angles are relative to the first object. |
* **Reference angle**: The angle between the objects that will be considered as zero. It offsets all the angle properties. If the reference angle is 15 degrees, asking for the current joint angle when the angle between the objects is 15 degrees in world coordinates will return 0, and set the maximum angle to 30 will set it to 45 (relative to the first object). | * **Reference angle**: The angle between the objects that will be considered as zero. It offsets all the angle properties. If the reference angle is 15 degrees, asking for the current joint angle when the angle between the objects is 15 degrees in world coordinates will return 0, and set the maximum angle to 30 will set it to 45 (relative to the first object). | ||
* **Minimum angle**: The minimum angle between the objects, relative to the first object. Must be lower than or equal to the maximum angle. | * **Minimum angle**: The minimum angle between the objects, relative to the first object. Must be lower than or equal to the maximum angle. | ||
- | * **Maximum angle**: The minimum | + | * **Maximum angle**: The maximum |
<note tip>You can use revolute joints with angle limits to simulate articulations, | <note tip>You can use revolute joints with angle limits to simulate articulations, | ||
- | * **Motor**: If enabled, the joint will add torque to the second object to make it rotate without the need of an external force... like a motor. If you enable it, remember to set a motor speed and a maximum motor torque! | + | * **Motor**: If enabled, the joint will add torque to the second object to make it rotate without the need of an external force, like a motor. If you enable it, remember to set a motor speed and a maximum motor torque! |
- | * **Motor speed**: The target motor speed, in degrees per second. This is the speed the second object will try to reach while rotating around the first object. Motor speed can be positive to rotate the object in a clockwise direction, or negative to rotate it in the anticlockwise direction. | + | * **Motor speed**: The target motor speed, in degrees per second. This is the speed the second object will try to reach while rotating around the first object. Motor speed can be positive to rotate the object in a clockwise direction or negative to rotate it in the anticlockwise direction. |
- | * **Maximum motor torque**: The maximum torque the motor can spend to reach the target motor speed. Must be positive. | + | * **Maximum motor torque**: The maximum torque the motor can spend to reach the target motor speed must be positive. |
Also, you can access the following values during simulation: | Also, you can access the following values during simulation: | ||
* **Joint angle**: The current angle between the objects, relative to the first object and affected by the reference angle. | * **Joint angle**: The current angle between the objects, relative to the first object and affected by the reference angle. | ||
- | * **Joint speed**: The current joint angular speed, i.e. the speed the second object is rotating around, relative to the first object rotation. | + | * **Joint speed**: The current joint angular speed, i.e., the speed the second object is rotating around, relative to the first object rotation. |
* **Joint motor torque**: The current motor torque, it can be lower than the maximum motor torque, as it's the required torque to reach the target motor speed. | * **Joint motor torque**: The current motor torque, it can be lower than the maximum motor torque, as it's the required torque to reach the target motor speed. | ||
Line 166: | Line 168: | ||
### | ### | ||
- | Prismatic joints work like " | + | Prismatic joints work like " |
Settings specific for prismatic joints: | Settings specific for prismatic joints: | ||
* **Axis angle**: The angle that determines the movement direction, an axis angle of 0 means a horizontal movement. The value is given in world coordinates, | * **Axis angle**: The angle that determines the movement direction, an axis angle of 0 means a horizontal movement. The value is given in world coordinates, | ||
- | * **Reference angle**: As in revolute joints, this angle adds an offset to the axis, establishing a new "angle zero". If the reference angle is 15, an axis angle of 15 in world coordinates (relative to the first object direction) will be treated as 0. | + | * **Reference angle**: As in revolute joints, this angle adds an offset to the axis, establishing a new "angle zero." |
- | * **Translation limits**: If enabled the second object movement will be limited between the given minimum and maximum translations. | + | * **Translation limits**: If enabled, the second object movement will be limited between the given minimum and maximum translations. |
* **Minimum translation**: | * **Minimum translation**: | ||
* **Maximum translation**: | * **Maximum translation**: | ||
- | <note important> | + | <note important> |
- | * **Motor**: If enabled, the joint will apply a force to the second object to reach a given motor speed. If you enable it, remember to set a motor speed and motor maximum force! | + | * **Motor**: If enabled, the joint will apply a force to the second object to reach a given motor speed. If you enable it, remember to set a motor speed and a maximum |
- | * **Motor speed**: The target speed the motor will try to reach, if positive the second object will move in the axis direction, and in the opposite direction if negative. | + | * **Motor speed**: The target speed the motor will try to reach; if positive, the second object will move in the axis direction, and in the opposite direction if negative. |
- | * **Maximum motor force**: The maximum amount of force the motor can spend to reach the target speed. | + | * **Maximum motor force**: The maximum amount of force the motor can spend to reach the target speed. |
Also, you can access the below values during simulation: | Also, you can access the below values during simulation: | ||
- | * **Joint translation**: | + | * **Joint translation**: |
* **Joint speed**: The current speed the second object is moving at, along the axis and relative to the first object speed. | * **Joint speed**: The current speed the second object is moving at, along the axis and relative to the first object speed. | ||
- | * **Joint motor force**: The current force the motor is applying to the second object, this value can be lower than the maximum motor force as it's the force needed to reach the target motor speed. | + | * **Joint motor force**: The current force the motor is applying to the second object; this value can be lower than the maximum motor force as it's the force needed to reach the target motor speed. |
###Pulley joint | ###Pulley joint | ||
- | A simple joint with a simple name. This joint makes the summation of the distances from each object to its ground position to be constant, it's a lot easier to understand using other words: simulates a pulley :) | + | A pulley joint simple joint with a simple name. This joint makes the summation of the distances from each object to its ground position to be constant; it's a lot easier to understand using other words: |
- | Imagine you have a box hanging 3 meters under a fixed point A, and a circle hanging 2 meters under a fixed point B, both objects attached to the ends of the same rope. The rope has a constant length, so if you move the box up, now hanging just 1 meter under A, the circle has to move down the same distance, now 4 meters under B, this way the distance between the box and A plus the distance between the circle and B is always 5 meters:\\ | + | Imagine you have a box hanging 3 meters under a fixed point A and a circle hanging 2 meters under a fixed point B, both objects attached to the ends of the same rope. The rope has a constant length, so if you move the box up, now hanging just 1 meter under A, the circle has to move down the same distance, now 4 meters under B, this way the distance between the box and A plus the distance between the circle and B is always 5 meters:\\ |
`distance(box, | `distance(box, | ||
**Ratio**: | **Ratio**: | ||
- | Easy, no? now the crazy part, this joint supports an extra setting: ratio. The ratio makes the rope to be more extensible | + | Easy, no? Now the crazy part, this joint supports an extra setting: ratio. The ratio makes the rope to be more extensible |
- | Going back to our initial example: The box 3 meters under A, the circle 2 meters under B, but with a ratio = 0.5. Now, moving the box 2 meters upward will make the circle move 4 meters downward. | + | Going back to our initial example: The box 3 meters under A, the circle 2 meters under B, but with a ratio = 0.5. Now, moving the box 2 meters upward will make the circle move 4 meters downward. |
`distance(box, | `distance(box, | ||
(Note that the first equation is a particular case of this one, with ratio = 1). | (Note that the first equation is a particular case of this one, with ratio = 1). | ||
- | Also, please note that there is not a " | + | Also, please note that there is not a " |
Here are the joint settings: | Here are the joint settings: | ||
- | * **First ground point**: The fixed point the first object is attached (in the examples, | + | * **First ground point**: The fixed point the first object is attached (in the examples, point A). |
- | * **Second ground point**: The fixed point the second object is attached (in the examples, | + | * **Second ground point**: The fixed point the second object is attached (in the examples, point B). |
- | * **First length**: The initial rope length between the first object and its ground point, if the value is negative or zero the distance at the moment of creating the joint is used. | + | * **First length**: The initial rope length between the first object and its ground point; if the value is negative or zero, the distance at the moment of creating the joint is used. |
- | * **Second length**: The initial rope length between the second object and its ground point, if the value is negative or zero the distance at the moment of creating the joint is used. | + | * **Second length**: The initial rope length between the second object and its ground point; if the value is negative or zero, the distance at the moment of creating the joint is used. |
* **Ratio**: Explained above, the equivalence between the distance in each side. If the ratio is = 0.33, 1 meter on the first side is equivalent to 3 meters on the second side. | * **Ratio**: Explained above, the equivalence between the distance in each side. If the ratio is = 0.33, 1 meter on the first side is equivalent to 3 meters on the second side. | ||
###Gear Joint | ###Gear Joint | ||
- | This joint is very special, instead of joining two bodies directly, gears join two other joints, those child joints must be revolute or prismatic.\\ | + | This joint is very special; instead of joining two bodies directly, gears join two other joints, those child joints must be revolute or prismatic.\\ |
- | When two joints are linked through a gear joint the movement of one of the joints makes the other joint to move. For example, moving an object along the axis on a prismatic joint will make the linked revolute joint to rotate, and vice versa. | + | When two joints are linked through a gear joint, one of the joints |
- | This joint is also very tricky! | + | This joint is also very tricky! |
You can gear together two revolute joints, two prismatic joints, or a revolute and a prismatic, but always the first body of each of the joints must be static! | You can gear together two revolute joints, two prismatic joints, or a revolute and a prismatic, but always the first body of each of the joints must be static! | ||
- | < | + | < |
The gear joint settings: | The gear joint settings: | ||
- | * **First joint**: A revolute or prismatic joint, will be linked to the second joint. | + | * **First joint**: A revolute or prismatic joint will be linked to the second joint. |
- | * **Second joint**: A revolute or prismatic joint, will be linked to the first joint. | + | * **Second joint**: A revolute or prismatic joint will be linked to the first joint. |
- | * **Ratio**: Like the pulley joint, gears support a " | + | * **Ratio**: Like the pulley joint, gears support a " |
<note important> | <note important> | ||
Line 225: | Line 227: | ||
###Mouse Joint | ###Mouse Joint | ||
- | This joint is not necessarily related to the mouse, but it's very common. | + | This joint is not necessarily related to the mouse, but it's very common. |
- | Note that it's another exception from the other joints | + | Note that it's another exception from the other joints |
Settings for the mouse joint: | Settings for the mouse joint: | ||
Line 233: | Line 235: | ||
* **Target**: | * **Target**: | ||
<note important> | <note important> | ||
- | * **Maximum force**: The maximum force the joint can apply on the object to reach the target position, the greater the force, the faster the object will move. Must be positive. | + | * **Maximum force**: The maximum force the joint can apply on the object to reach the target position; the greater the force, the faster the object will move. It must be positive. |
* **Frequency**: | * **Frequency**: | ||
* **Damping ratio**: Works like the distance joint damping ratio, slowing down the object along the time. | * **Damping ratio**: Works like the distance joint damping ratio, slowing down the object along the time. | ||
Line 241: | Line 243: | ||
###Wheel Joint | ###Wheel Joint | ||
- | A very specified joint, when you need wheels you'll want this joint, and it's hard to think a case different than vehicles | + | A very specified joint, when you need wheels, you'll want this joint, and it's hard to think of a case different than a vehicle' |
- | Made to simulate | + | Made to simulate |
- | You can think in the wheel joint as a revolute plus a prismatic joint:\\ | + | You can think of the wheel joint as a revolute plus a prismatic joint:\\ |
- | The revolute joint is used to make the second object (the wheel) | + | The revolute joint is used to make the second object (the wheel) rotate, and, as the classic revolute joint, it supports a motor to simulate the vehicle motor, |
- | The prismatic joint function is to simulate the vehicle wheel suspension and, as the classic prismatic joint, you can set the axis angle to define the wheel translation direction. Generally, the axis direction is vertical but, for example, motorbikes have a front wheel suspension direction different (and in some cases very far) from vertical. | + | The prismatic joint function is to simulate the vehicle wheel suspension, and, as the classic prismatic joint, you can set the axis angle to define the wheel translation direction. Generally, the axis direction is vertical, but, for example, motorbikes have a front-wheel suspension direction different (and in some cases very far) from vertical. |
<note important> | <note important> | ||
Line 252: | Line 254: | ||
Here are the wheel joint settings: | Here are the wheel joint settings: | ||
* **Axis angle**: Equivalent to the prismatic joint axis angle, it determines the direction of movement (or sliding) between the wheel and the first object. | * **Axis angle**: Equivalent to the prismatic joint axis angle, it determines the direction of movement (or sliding) between the wheel and the first object. | ||
- | * **Frequency**: | + | * **Frequency**: |
- | * **Damping ratio**: | + | * **Damping ratio**: |
- | * **Motor**: If enabled the joint will add torque to the wheel (second object) to reach a given motor target speed. If you enable it, remember to set the motor speed and the maximum motor torque! | + | * **Motor**: If enabled, the joint will add torque to the wheel (second object) to reach a given motor target speed. If you enable it, remember to set the motor speed and the maximum motor torque! |
- | * **Motor speed**: The target angular speed the wheel will try to reach. | + | * **Motor speed**: The target angular speed the wheel will try to reach. |
- | * **Maximum motor torque**: The maximum amount of torque the joint can apply to the wheel to reach the motor target speed. | + | * **Maximum motor torque**: The maximum amount of torque the joint can apply to the wheel to reach the motor target speed. |
And some extra values you can access during simulation: | And some extra values you can access during simulation: | ||
Line 265: | Line 267: | ||
###Weld Joint | ###Weld Joint | ||
- | This joint is super basic, just tries to stick/glue two objects together, and move them as if it were a single object. | + | This joint is super basic; just tries to stick/glue two objects together and move them as if they were a single object. |
- | <note important> | + | <note important> |
- | The weld joint specific settings: | + | The weld joint-specific settings: |
* **Reference angle**: The angle the second object will have, relative to the first object angle. | * **Reference angle**: The angle the second object will have, relative to the first object angle. | ||
< | < | ||
Line 277: | Line 279: | ||
###Rope Joint | ###Rope Joint | ||
- | Another simple joint. | + | Another simple joint. |
- | As in the pulley joint, there is not a real rope at all, the joint just checks the distance between the objects, and react if the distance is greater than the given length. | + | As in the pulley joint, there is not a real rope; the joint just checks the distance between the objects and reacts |
The only setting specific for the rope joint: | The only setting specific for the rope joint: | ||
- | * **Maximum length**: | + | * **Maximum length**: |
###Friction Joint | ###Friction Joint | ||
- | Friction joint simulates friction in a Z-axis, it slows down the relative speed and/or the angular speed between two objects, so that it can simulate linear and angular friction. | + | Friction joint simulates friction in a Z-axis; it slows down the relative speed and/or the angular speed between two objects |
<note tip>If one of the objects is static, the friction joint can be used to correctly simulate friction in a top-down game, like a pool table or top-down racing games.</ | <note tip>If one of the objects is static, the friction joint can be used to correctly simulate friction in a top-down game, like a pool table or top-down racing games.</ | ||
Friction joint settings: | Friction joint settings: | ||
- | * **Maximum force**: The maximum force the joint can apply to the objects, higher values generate higher linear friction. | + | * **Maximum force**: The maximum force the joint can apply to the objects; higher values generate higher linear friction. |
- | | + | |
###Motor Joint | ###Motor Joint | ||
Line 298: | Line 300: | ||
Two things to take into account: | Two things to take into account: | ||
- | * The joint is not rigid at all, the objects can be far away from their target position or angle, a correction factor will tell how fast they will move and rotate to reach the rest pose.\\ | + | * The joint is not rigid; the objects can be far away from their target position or angle, a correction factor will tell how fast they will move and rotate to reach the rest pose.\\ |
- | For example, imagine one of these punching | + | For example, imagine one of these punching |
* Motor joints will stop if there are obstacles.\\ | * Motor joints will stop if there are obstacles.\\ | ||
Going back to the punching bag example, if you push it with a big object to keep it on the ground, the motor joint won't be able to push it back, like in real life. | Going back to the punching bag example, if you push it with a big object to keep it on the ground, the motor joint won't be able to push it back, like in real life. | ||
- | < | + | < |
The motor joint specific settings: | The motor joint specific settings: | ||
- | * **Offset X/Y**: The offset position for the second object, relative to the first one. To use the current | + | * **Offset X/Y**: The offset position for the second object, relative to the first one. To use the current |
- | * **Offset angle**: The angular offset for the second object, relative to the first one. To use the current objects relative angle at the moment of creating the joints use `SecondObject.Angle() - FirstObject.Angle()` | + | * **Offset angle**: The angular offset for the second object relative to the first one. To use the current objects relative angle at the moment of creating the joints, use `SecondObject.Angle() - FirstObject.Angle()` |
- | * **Maximum force**: The maximum force the joint can apply to the objects to move them to the target position. Higher values will move the objects faster, in case of being necessary. If this value is zero, there won't be a linear correction and objects won't move to reach the target position. | + | * **Maximum force**: The maximum force the joint can apply to the objects to move them to the target position. Higher values will move the objects faster, in case of being necessary. If this value is zero, there won't be a linear correction, and objects won't move to reach the target position. |
- | * **Maximum torque**: The maximum torque the joint can apply to the objects to rotate them to the target angle. Higher values will rotate the objects faster, in case of being necessary. If this value is zero, there won't be an angular correction and objects won't rotate to reach the target angle. | + | * **Maximum torque**: The maximum torque the joint can apply to the objects to rotate them to the target angle. Higher values will rotate the objects faster, in case of being necessary. If this value is zero, there won't be an angular correction, and objects won't rotate to reach the target angle. |
* **Correction factor**: How fast the objects have to move and rotate to reach the target position and angle. The higher the correction, the faster the objects will move and/or rotate. The correction is limited by the maximum amount of force and torque the joint can use. | * **Correction factor**: How fast the objects have to move and rotate to reach the target position and angle. The higher the correction, the faster the objects will move and/or rotate. The correction is limited by the maximum amount of force and torque the joint can use. |