So I have a model (made from realitykit pro) and I've added it as an Entity in my project on Xcode. The model is a simply rectangular prism (meant to simulate a block of skin). When a user drags their mouse in a line across a face of the model, I want to simulate making an incision by perhaps indenting/splitting the model on the axis the user has drawn. How would I go about this?
I'm not sure if you can animate an Entity based on a user's mouse position.
I've already importing a pre-made animation that splits a rectangle in half, but it does not rely on user's mouse position, which is something I'd like to implement so that incisions are made where the user wants.
Thank you!
Detecting the swipe is pretty easy. Put a gesture recognizer on the
RealityViewand track the start/end coordinates. See theExampleVisionOSapp in https://github.com/nicklockwood/Euclid.The hard part is animating the incision. That’s a completely different problem. I have no idea on this bit.