Skip to main content

Physics

Pickupabble objects require 3 components:

  • Rigid body: allows object to interact with physics [called a rigid body because there is no deformation]
  • Collider: allows the collider to collide with other colliders (so the object will not simply pass through everything)
  • VRCPickup: allows the object to be grabbed in VRChat

To make a VRChat object pickupabble, add the VRCPickup component to the GameObject.
This will automatically add a rigidbody (if there isn’t one already).

The collider types [in order of lowest to highest performance cost]:

  • Sphere [1 vector]
  • Capsule [2 vectors and the distance between them]
  • Box [a volume]

A mesh collider will form it’s collider to the mesh. If applying to an object with a rigidbody, the mesh collider should be set to convex so it can collide with other objects with rigidbodies that have convex mesh colliders.
A convex collider will also limit the collision mesh to 256 triangles.
In addition, the naming convex relates to conavity; the collider is not concave; for example, any openings, like on a bowl or a cup would be covered with a convex collider.
When creating colliders for objects with a rigidbody, it is best to use a primitive or a combination of them for a result that is both performance and believable.

The orthographic view mode (where everything is of equal distance to the camera) is extremely helpful for editing colliders. To enable it, click on the box in the top right corner of the scene view.
For example, on a beer bottle, I would use a capsule collider around the part that can roll, and a box collider inside the capsule that goes to the top and bottom of the bottle so it can stand up.

For optimizing pickups, make sure that all of them are under a single gameobject at the root of your hierarchy. Every object with a rigidbody not only needs to update its transform every frame, but also the transform of all of its parent gameobjects. Ensuring that all the pickups are under a single parent keeps your hierarchy organized while also not wasting performance.

For even more believability, you can apply physics materials to colliders; for example, if you have a carpet floor, you can apply a high friction physics material to it, and a low friction physics material to an ice sheet. Several physics materials come with the Unity Standard Assets[assetstore.unity.com].

DO NOT USE MESH COLLIDERS FOR COMPLEX MESHES! (This is extremely taxing!)
It’s best to add one or multiple primitives (box, sphere, or capsule) collider(s) to the object and make the colliders conform to the mesh that way.
In a 3D modeling program like Blender, you can create a set of simpler meshes in the same model, turn off their mesh renderer, and give the simpler meshes a mesh collider. This will save performance and most players won’t notice the difference.

Unity also uses different types of joints. These can be useful for creating things like physical doors.