Realistic Soccer VR
Hello everyone,
Im a newbie at Unity and recently got the awesome opportunity to play around with the HTC Vive. Im in the process of trying to make a realistic Vive soccer game where the controllers act as the feet (weird i know).
The problem is i cant create realistic collision between the controller and the ball. The Controller has a box collider attached with a rigidbody and a mass of 1. While the soccer ball has a sphere collider, rigidbody and a mass of 0.5. Ive been playing around with the rigidbody values such as mass and drag but to no avail. Im all out of ideas on how to create a realistic interaction between the ball and the kick. Frankily i dont know if im just being stupid at this point, i took a look at the Newton VR scripts (http://www.vrinflux.com/newton-vr-physics-based-interaction-on-the-vive/) for a possible answer but the physics rely on the ball being attached to the controller not impacting the controller. Please any help, tips or advice will be greatly appreciated. Im really stuck at this point.
How is what you're getting, not realistic? $$anonymous$$aybe you need to add some drag to the ball...
So currently when the box collider attached to the Vive controllers interacts with the ball there is a lag, as well as the ball doesnt travel at the correct speed and velocity that is equivalent to the power of the kick.
Answer by rmassanet · Sep 22, 2016 at 10:30 AM
It's hard to say without know Vive myself. But I'm guessing that the controllers are moved using transform.position
and transform.rotation
instead of using rigidbody.velocity
or applying forces.
That makes physics calculations totally unreliable. If you want collisions to be realistic, you should move objects by applying forces (or setting velocity) to their rigid bodies.
Well, I was assu$$anonymous$$g you were not moving the ball directly, but it moved as a consequence of its interaction with the controllers. If you do move the ball, do it through its rigibidbody too.
By the way, you should also apply physical materials to objects, if you want them to behave in a more realisitic way. Go to Assets > Create > Physics $$anonymous$$aterial. Create a material and set its properties as you wish. Then assign it to the collider of each object.
I did set the physics material of the ball to behave bouncy, thanks for the tip i will try it out.
Answer by Heemrad · Sep 23, 2016 at 08:31 AM
@rmassanet So currently the problem is not the two objects interacting and behaving appropriately, it is the collision of the controller interacting with the soccer ball at speed. Currently if i move the controller at speed to collide with the ball, hoping the momentum of the controller (kick) causes the ball to fly in the appropriate direction but instead the ball doesn't move at the appropriate speed, sort of jitters and gets stuck then starts rolling away slowly.
The collision between the two objects does not happen seamlessly, like a real life kick to a soccer ball should. It seems the collision detection isn't accurate or fast enough? Any ideas?
Please, don't post a reply to my answer as another answer. If you do that, I might not get notified of the update.
How are you moving the controller with speed?