Aller au contenu

Add a physical model to a 3D file

SmartShape has a feature to make the FPS camera collide with the model. This allows more realistic interactions by preventing the user from going through walls and floors.

There are three methods to add a physical model to a 3D file:

Use a specific 3D model as the physical model

When the file containing the physical model is different from the 3D model visible to the user, one can:

  1. Generate a file with only the physical model.
  2. Merge the physical model with the original 3D model into a single scene.

Note: Colliders generated using this method are mesh colliders. They match exactly the geometry of the 3D model.

## Generate a file with only the physical model.
smartshape-converter \
    -i my-collider.fbx \
    --output-collider \
    -o my-collider.fbx.scene
## Merge the physical model with the original 3D model into a single scene.
smartshape-converter \
    -i my-collider.fbx.scene \
    -i my-model.fbx \
    -o my-model.fbx.scene

Use a simplified version of the 3D model

When there's no separate file containing the physical model, one can instead:

  1. Generate a file with only the physical model based on a simplified version of the visible 3D model.
  2. Merge the physical model with the original 3D model into a single scene.

Note: Colliders generated using this method are mesh colliders. They match exactly the geometry of the simplified 3D model.

## Generate a file with only the physical model.
smartshape-converter \
    -i my-model.fbx \
    --output-collider \
    --simplify-geometry 0.05 \ # Simplify the geometry of the model to 5% of its original complexity.
    -o my-collider.fbx.scene
## Merge the physical model with the original 3D model into a single scene.
smartshape-converter \
    -i my-collider.fbx.scene \
    -i my-model.fbx \
    -o my-model.fbx.scene

Add the prefix collider_ to specific 3D objects

3D objects with a name that begins with the text collider_ will automatically be treated as physical models by SmartShape. No additional conversion is needed, uploading the file in SmartShape works out-of-the-box.

Note: Colliders generated using this method are "Convex hull" colliders. They don't exactly match the geometry of the 3D model, they represent the convex hulls of the 3D objects.


November 24, 2022 June 8, 2021