Search code examples
unity-game-enginehololens

Improvement for a lightweight and rapid object interaction using Unity


I have a question about the interaction of objects with each other. Especially with regard to the application on Hololens 2 and the computing power that comes with it.

What would I like to do:

I have two objects. One is a simple staff and is moved by the player / user of HoloLens 2. The other object is a complex construct into which the staff shall be inserted.

Current behaviour:

After adding a BoxCollider and Rigidbody component to the staff and a MeshCollider to the complex object, I was able to create some interaction. Unfortunately the whole process is so expensive that it causes the HoloLens to crash.

My question:

  • Since I don't need any physics, but only pure non-penetrable objects, does anybody have a hint how I can achieve better performance?
  • Or what I have to change completely to make it as fast and lightweight as possible?

Notes:

  • Most entries online that I have found related to firing events or triggers that I do not need at all.
  • Even in PlayMode on the local computer it stutters.
  • Due to the complexity of the mesh I cannot simplify the target object.

Any help is welcome.


Solution

  • You could always decimate the complex object in something like blender: https://docs.blender.org/manual/en/latest/modeling/modifiers/generate/decimate.html

    Import the decimated object into unity then use that mesh for the mesh collider instead of the rendered mesh.

    That should allow you to simplify the mesh so it's more performant but still be plenty complex enough to closely follow the geometry of the original model.

    I've used a similar method to reduce improve shadow rendering performance quite effectively.