Skip to content

Instantly share code, notes, and snippets.

@anupamchugh
Created January 20, 2020 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anupamchugh/71940f51fa92db340eac4538d6fc5733 to your computer and use it in GitHub Desktop.
Save anupamchugh/71940f51fa92db340eac4538d6fc5733 to your computer and use it in GitHub Desktop.
class CustomEntityB: Entity, HasModel, HasAnchoring, HasCollision {
var collisionSubs: [Cancellable] = []
required init(color: UIColor) {
super.init()
self.components[CollisionComponent] = CollisionComponent(
shapes: [.generateSphere(radius: 0.2)],
mode: .trigger,
filter: CollisionFilter(group: CollisionGroup(rawValue: 2), mask: CollisionGroup(rawValue: 2))
)
self.components[ModelComponent] = ModelComponent(
mesh: .generateSphere(radius: 0.2),
materials: [SimpleMaterial(
color: color,
isMetallic: false)
]
)
}
convenience init(color: UIColor, position: SIMD3<Float>) {
self.init(color: color)
self.position = position
}
required init() {
fatalError("init() has not been implemented")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment