Created
January 20, 2020 11:50
-
-
Save anupamchugh/71940f51fa92db340eac4538d6fc5733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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