Tutorial 2: Simple cylinder
In this tutorial you will:
- Create a basic geometry component
- Modify its visual
- Add a collision and mass
Let's start by creating a new component in the Library page. If you don't know how to do it, please take a look to Creating a new component.
First, let's expand everything in the tree until the geometry is visible, as in the above picture, then right-click it to get the available options. Next, click on cylinder in order to update the geometry.
Now that we have our cylinder, let's change its properties.
Select length element and then click on the value property, located at the bottom.
A pop-up will be shown. Change the length to 2 and click OK.
You can see the result on the following picture.
Finally, let's also change the color. For that, we need to include a new child to the visual element. Right-click it, and then click on material element.
Now, expand the material element and click on color. At the bottom, click on the value property to modify it.
Pick the color you prefer and click OK once you are ready. In this example we have used R: 139, G: 13, B: 242.
The color selector design is different in every browser. This example image is from Firefox.
The cylinder's color is now updated!
Adding a collision
At this point we have the visual part ready, which specifies how the component is going to be shown to the user. However, we also need to describe the component to the physics engine so it can interact with other components.
In order to add a collision, right click on the base_link element and pick collision.
Next, expand everything inside collision, and you will see a geometry element again. Let's change it to cylinder and set the length to the same value as above.
In order to allow the component to be affected by gravity, we need to include an inertial element to the base_link. It includes properties such as the body mass, inertia and its centre of gravity.
To add this element, right-click the base_link in the tree and pick intertial.
By adding a inertial element, a mass of 1kg will be set by default. Let's click on the Value field, at the bottom to change it.
A modal will be shown. Change the mass to 0.5, for example, and click OK.
Your cylinder is now finished! Let's take a screenshot of your newest component and save it.
You can now add it to a library and start playing around. You can see an example below:
Wow, this is huge! What about if you change the cylinder to make it more compact? Then, you can add it to a product-entry and test it with some conveyors.