generateCollisionShapes() doesn't seem to work

342 views Asked by At

When applying generateCollisionShapes() on the root of the following hierarchy nothing happens. The 'collision' component of the root entity is still nil.

The root entity class looks like this:

class SomeEntity: Entity, HasAnchoring, HasModel, HasCollision

The child entity is loaded from .usdz file, and its hierarchy is: Entity -> [ModelEntity, ModelEntity]

So the final hirarchy is:

SomeEntity -> Entity -> [ModelEntity, ModelEntity].

Now, when applying the following lines, SomeEntity's collision component stays nil and I'm getting the following log message:

someEntity.generateCollisionShapes(recursive: true)
arView.scene.addAnchor(someEntity)
arView.installGestures([.all], for: someEntity)

The log message is: [Collision] Bad paramater (SphereRadius), value = 0.000000, passed to shape creation.

  • It sounds like Entities with no model components breaks the recursive operation

Edit 1: It works well for model entities created in code or in Reality Composer. for entities loaded from USDZ file the behavior is unexpected as the model hierarchy seems to play an important part.

0

There are 0 answers