見出し画像

【How to make a world: More techniques vol.1】 Colliders - walls, obstacles, and detections

We've gone through the installation and first steps courses and created a simple world and made it public. From this chaper, we will explain how to enrich your world, such as lighting and gimmicks!

★If you have not yet registered an account or installed VketCloudSDK, please refer to the installation section first.
[Installation]
Set up your account and world
Install Unity and VketCloud SDK

★If you still don't know how to create a world, how to build and upload, please refer to the beginner's course.
[First steps]
Overview 
Create a room  
Build and upload your world
Place some objects in your world

This chapter will cover topics about collider.
A collider is a setting for whether the avatar [hit] or [pass through] when it hits an object .

As you can see in this image, if the collider is set, avatars can ride on it and collide with other objects.
Without the collider, the avatar will slip through like the image on the right.

Now let's move on to how to set it up.

BOXcollider (box collider)

Firstly, let's talk about BOXcollider . Add "Cube", which we've learned in the First Steps, in the hierarchy. You will notice that there is a component "BoxCollider" in the inspector.

It has a checkmark on the checkbox. You may uncheck it to disable the collider.
Also, remember that you can change the range of the collider by changing the size of "BoxCollider" in the inspector.

It is also possible to hide the rendered object only while leaving the collider.
Let's uncheck "Mesh Renderer" in the inspector while keeping "BoxCollider" checked.
This leaves the collider only with no objects visible.
It can be used when you want to create an invisible wall or set simpler collider.

So how can we attach colliders to objects other than Cubes? Her comes "MeshCollider".

HEO MeshCollider

Set "MeshCollider" and "HEOMeshCollider" components on objects with shapes other than "Cube" .
Select the object you want to add a collider to.
* If the objects are hierarchical, select the one with the Mesh Filter.
② When you press the "Add Component" button in the inspector , a search window will appear.

Select Child in Hierarchy

③ Call "MeshCollider" and "HEOMeshCollider" .

A collider is now set on the seat of the chair!
Let's build and check.

Now you can step on the chair.
However, the use of "MeshCollider" may hamper the performance and cause lags if the number of polygons of the object to add collision detection is large.
Keep the use of Mesh Collider to the case of absolute necessity. The load can be lightened by substituting it with "BoxCollider".

Using a BoxCollider instead would look like this:
Doing this will improve the performance, so give it a try!

mesh collider (left) and box collider (right)

HEO Collider

Finally, we will explain about HEO Collider.
HEO Collider is used to add various behaviors to the set BOXcollider. Call "HEO Collider" from "Add Component".


Select collider type

Click the triangle to the right of the "Collider Type" column to display the type list.
Now select the type of collider.

Collider: Act as a normal collider. 
Area: Act as collision detection for HEOAreaCollider, which can then call some actions. Avatars can pass through it.

Next, specify what object the collider is for with the "collider target".

There are three types: "None", "Avatar", and "Camera".

Examples of collider targets

If Avatar is the target of the collider
→ You can prevent the avatar from slipping through the walls of the building, etc., and do not interfere with the camera. You can prevent the situation that "I entered the building, but I can not see the inside because the wall is in the way!"
When Camera is the target of the collider
→ Conversely, only the camera has collision detection here. Use it to prevent the camera from getting stuck in the wall!

Colliders are an essential part of creating a comfortable world.
As an application, you can also make a "vehicle" or "elevator" by moving the collider. Let's master it and create a comfortable world!

[How to make a world More techniques vol.2] Emission - make objects glow
[How to make a world: More techniques vol.3] Lighting - Lighting settings and bake