• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by Tifoo · Jun 15, 2016 at 06:21 AM · physicsvrball

Hit ball with racket

Hi,

I'm developping a VR game with HTC Vive, and i'm starting by making a ball interact with a racket. The ball is a Sphere (radius 0.1) with a rigidbody. The Racket is a cube, in a rectangular shape : x:0.2 y:0.2 z:0.03

The ball interact with the racket quite well at slow speed, but when I move my racket faster, it goes through..

I tried to tweek some physics value : Fixed Timestep to 0.01 (1/90 for the Vive) Solver Iteration : from 6 to a lot a values, even 100 (just for test purpose), it helps a little but not too much.

I also tried to add the DontGoThroughThings scripts but it does not help

I changed the collision detection to "Continious Dynamic" for both and try changing Interpolate to the interpolate and extrapolate..

Nothing will do, How should I achieve this? I do not want to code that (should I?), because it has to feel very realistic (VR..) when my ball is on my racket. I assume Unity should be able to handle that?

Thank you

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Brijs · Jun 15, 2016 at 09:39 AM 0
Share

To move and rotate the ball and rocket use rigidbody methods only ins$$anonymous$$d changing transform. $$anonymous$$eep collision detection to "Continuous Dynamic" and Interpolate to "Interpolate" That should solve your problem

Show more comments
avatar image Kmausser · Jun 22, 2016 at 08:22 PM 0
Share

Did you ever figure this out? I'm having the same problem. I'm using stonefox's VRT$$anonymous$$ scripts which are similar to newton. alt text

Videos of what my golf game looks like with this frustration:

https://youtu.be/_QZBl3zHNf0

https://youtu.be/2zdHsPZBQ7Y

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by BostonLeeK · Aug 06, 2018 at 11:45 AM

The post is old but If somebody will stuck on this: The only one way to make it working nice is to make collision detection and changing velocity of the ball without rigidbody on the racket.

So, how i made it:

1) create empty prefab (name it RacketController for example) and give him box collider with a trigger and rigidbody with cinematic, like a child of this object i add Racket with only box collider. (I need parent cose i must to change the child visible or not for type of controller tracker or joystick)

2) Add a script to RacketController that change Rigidbody position (important that it is rigidbody) to position of my right controller

3) Add checking velocity of the rigidbody and saving it to variable

4) Create a ball with a rigidbody and sphere collider

5) Create a script and add it to the ball where i cheeking the collision and use such formula

 direction = Vector3.Reflect(lastFrameVelocity.normalized, collision.contacts[0].normal);
 this.GetComponent<Rigidbody>().velocity = direction * speed;

where lastFrameVelocity is the velocity of the ball on starting collision and collision is the object that ball is touching. And after i just add new velocity to the object. And i the object name is Racket for example i get the velocity from RacketController and multiply it with the ball velocity.

 float addForce = RacketController.GetComponent<TrackerFollow>().RacketVelocity.magnitude;
 speed += addForce;

And i remove physics material from the ball to make all work done by script.

The final result not best but now the ball not crossing the object through. There need some working with a script to make force on ball more realistic but it work.

Hope for someone this post will be useful. And this is result on video: https://youtu.be/F2_PllPlV4M

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by vkapoor · Jan 23 at 01:33 PM

The video link does not work anymore. Can you please post again? I am wondering how you check the velocity of a Kinematic Rigidbody in step 3 above. Do you calculate it based on transform.position?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Racquet in VR, doesnt hit the ball, and sometimes it "sticks" to the ball. 1 Answer

How to predict where the soccer ball should be intercepted by an AI player after being kicked? 0 Answers

Ball passes through the floor on movement 1 Answer

BallShooting Game Issue with Detecting ball stopping when rolling uphill 1 Answer

Curves on Unity 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges