Over the last few days I’ve been attempting to make a simple table tennis game using SteamVR and the HTC Vive. The idea seems simple enough; add a paddle gameobject to the controller, add colliders to the paddle and ball and it should all work itself out. But it doesn’t, as the controllers are not Rigidbodies and their movement works separately from the Unity physics system. As such it creates issues like the paddle moving through the ball when the controller moves too quickly, or the velocity of the controller not mattering in the collision since its rigidbody’s velocity is always zero.
One thing I’ve tried is to mark the object as IsKinematic and to match its position to the controller using MovePosition and MoveRotation on the paddle Rigidbody. I also turned on interpolation to make sure moving the paddle too quickly doesn’t make it go through the ball. This sort of works, but with a huge delay; the paddle is always lagging way behind the controller - so this is not an option.
Another thing I’ve been trying is to implement my own physics code for the paddle, but in a way I feel like this shouldn’t be necessary as the controller already tracks all of the same variables as the ‘normal’ rigidbodies do, such as velocity etc. I’m wondering whether there is a possibility for some kind of ‘hybrid’ collision, where I could plug the SteamVR controller’s velocity, location etc. into the Unity Physics system.
Does anyone have any ideas on how I could approach this scenario?