I have a created an AnchorEntity for my index finger tip and then created a model entity (A sphere) as a child of it. This model entity has a collision component and a physics body component. I tried using dynamic and kinematic modes for the physics body component.
I have created a plane from a cube that has collision component and a static physics body.
I have subscribed to the CollisionEvents.Began on this plane. I have also stored it in a EventSubscription state variable.
@State private var collisionSubscription: EventSubscription?
The I subscribed as follows
collisionSubscription = content.subscribe(to: CollisionEvents.Began.self,
on: self.boxTopCollision, { collisionEvent in
print("something collided with the box top")
})
The collision event fires when I directly put the sphere above the plane and let gravity do the collision, but when the the sphere is the child of the anchor entity, the collision events don't happen.
I tried adding collision and physics body component directly to the anchor entity and that doesn't work too.
I created another sphere with a physics body and a collision component and input target component and manipulate it with a drag gesture. When the manipulation is happening and collide the plane and the sphere the events don't happen when my sphere is touching the plane, but when the gesture end and the sphere is in contact with the plane, the event gets fired. I am confused as to why this is happening.
All I want to do is have a collider on my finger tip and want to detect the collision with this plane. How can I make this work?
Is there some unstated rule somewhere as where a physics body is manipulated manually it cannot trigger collision events?
For more context. I am using SpatialTrackingSession with the tracking configuration of .hand. I am successfully able to track the finger tip.