Since the 3 entities are children of Body, applying anything to the parent should (will?) effect the entire thing. Will be easy enough to test, right?
Post
Replies
Boosts
Views
Activity
Thanks Henry, for such a thorough answer.
You illustrate the problem. The last line where you call applyImpulse on physicsBody results in "Value of type 'PhysicsBodyComponent' has no member 'applyImpulse'". That's the challenge I am trying to resolve. Upon what object is applyImpulse supposed to be called on if not physicsBody as you (and I) have defined:
guard let physicsBody = tappedObject.entity.components[PhysicsBodyComponent.self] as? PhysicsBodyComponent else {
fatalError("PhysicsBodyComponent not found on the entity")
}
To further clarify, this is a gesture handler that shows the issue:
func Throw(objToThrow: EntityTargetValue<TapGesture.Value>) {
let entT = objToThrow.entity
let comp = entT.components
let pbc = comp[PhysicsBodyComponent.self]!
let physicsBodComp = pbc as PhysicsBodyComponent // Type casting is unnecessary as pbc is already a PhysicsBodyComponent
let impulse = SIMD3<Float>(x: 0.0, y: 10.0, z: 0.0)
let position = SIMD3<Float>(x: 0.0, y: 0.0, z: 0.0)
let referenceEntity: Entity? = nil
physicsBodComp.applyImpulse(impulse, at: position, relativeTo: referenceEntity); // <<< error here
}
Thanks!
I don't see it either. I suspect they took it out due to issues. I too would like to detect collisions with particles. Might be a question for DTS.
Cheers...
Same issue here. Would love to see how P.E.'s work. Any ETA on repairs?