'RealityKit – Add force to Entity at specific point
I have my entity which has also physics I check for it with the if let syntax:
if let scoot = scooter as? HasPhysics { ... }
this works as charm I am able to get the user tap by using UITapGestureRecognizer this is just the first iteration I would like to use the swipe or pan gestures ideally.
// I can get the location of the tap in the arView
let location = sender.location(in: arView)
// I can use this three approaches both of them returns me the Entity not sure which to use though
let hittest = arView.hitTest(location)
let results = arView.raycast(from: location, allowing: .existingPlaneInfinite, alignment: .any)
let entity = arView.entity(at: location)
At this stage I am in need of applying the force at the point of the Tap impact. Since I am in this iteration using tap, the force is always the same (in the next iteration I want to count with the velocity/vector of the impact and push my object with greater force on greater velocity gesture).
I just want to make sure the object is behaving the right way. Is this possible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
