I'm new to VisionOS development, and I'm stuck on a pretty straightforward question. I want to add a punching bag where the user can punch it with their hands, so I want it to be responsive to its actions. But I cannot figure out how it sticks, let's say, to the virtual scene ceiling. So it could swing but don't fall when the user punches it?
I'm new to VisionOS development, and I'm stuck on a pretty straightforward question. I want to add a punching bag where the user can punch it with their hands, so I want it to be responsive to its actions. But I cannot figure out how it sticks, let's say, to the virtual scene ceiling. So it could swing but don't fall when the user punches it?
Share Improve this question asked Mar 16 at 18:49 Alex FilatovAlex Filatov 2,3413 gold badges33 silver badges45 bronze badges1 Answer
Reset to default 1To simulate the physical behavior of the punching bag you definitely need to use the dynamics pin constraint
. I believe that in RealityKit 2025, the role of a pin constraint, allowing free rotation along all axes, can be performed by such an object as PhysicsSphericalJoint. On the other hand, this functioning can partially be performed by the single-axis PhysicsRevoluteJoint, which is also capable of simulating such phenomena as the operation of door hinges, a clock's pendulum, or Newton's cradle. Unfortunately, at the moment I don't see any way to configure dynamics pin constraints in the Reality Composer Pro 2.0 interface, so you can only do it programmatically.
As a bonus, I want to tell you that similar capabilities can be implemented in SceneKit using the SCNPhysicsBallSocketJoint object. But remember that any SceneKit scene can only be represented in visionOS as a 2D screen.