Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
1
Question by Zmurowski · May 18, 2016 at 09:32 PM · physicsvrthrowing

Spear throwing with HTC Vive

Hi

I'm a beginner in Unity but please bear with me.

I'm playing with Unity and HTC Vive. I've created a simple scene where you can pick up a spear and then throw it. Now the problem is - the physics of the spear don't really match a spear - it rotates around the axis perpendicular to the length of the spear. I was wondering how I can set it up so that the tip has all the weight and it carries the momentum of the throw. I have already tried changing the centre of mass of the RigidBodyObject and that changes the behaviour slightly, but there's still no momentum. The speed and movement of the spear comes only from the Vive controller.

I'll be grateful for your help.

Cheers

alt text

70342-spearthrow.jpg (77.4 kB)
Comment
Add comment · Show 7
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 SonicScrew12 · May 19, 2016 at 04:42 AM 1
Share

Could you give us an image or something like that? I'm having a hard time visualizing what you're describing.

avatar image Zmurowski SonicScrew12 · May 19, 2016 at 08:49 AM 0
Share

Here's the best I can illustrate it

alt text

spearthrow.jpg (77.4 kB)
avatar image FortisVenaliter Zmurowski · May 19, 2016 at 06:54 PM 0
Share

Can you also post a screenshot of how you've got your colliders set up on the spear? Unity calculates weight distribution by the collider setup.

Show more comments
avatar image Gaming-Dudester · May 19, 2016 at 10:29 PM -1
Share

WHAT!? YOU CAN $$anonymous$$A$$anonymous$$E VIVE GA$$anonymous$$ES WITH UNITY!?!

avatar image Mmmpies · May 24, 2016 at 03:07 PM 0
Share

How are you angling the spear when you throw it?

I'm assu$$anonymous$$g you attach it to the transform of your controller until you let go but is it set to be pitched at 35 - 40 degrees or does it's rotation also depend on the controller?

$$anonymous$$ight be worth looking at that if so.

avatar image Zmurowski Mmmpies · May 26, 2016 at 11:03 PM 0
Share

The rotation was caused by the angularvelocity of the controller being passed onto the spear.

Now I'd just like it to angle down as it falls - it's flight is pretty much straight.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by OrbitGames · May 19, 2016 at 07:11 PM

Try Transform.forward = rigidbody.velocity

Comment
Add comment · Show 5 · 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 FortisVenaliter · May 19, 2016 at 07:14 PM 0
Share

No, you don't want to manually adjust the rotation of a rigidbody if you can help it. It throws off the physics system.

avatar image OrbitGames FortisVenaliter · May 19, 2016 at 07:44 PM 0
Share

Even if you restrict the rotation on the rigidbody?

Another idea would be to use AddForceAtPosition on a point on the back of the spear, which adds a force in the opposite direction of the velocity, which would act as drag.

avatar image FortisVenaliter OrbitGames · May 19, 2016 at 07:49 PM 0
Share

But adding force would alter the thrown arc. Really, the best way to fix physics problems is to think about them from a real-world perspective. I asked to see how the colliders were set up because I think it would be most beneficial to add a new collider to the front that will make the object more front-heavy. Phantom forces often add more harm than good.

Right now the issue is likely that the weight is distributed evenly, which is far from the case in a real-life sphere.

Show more comments
avatar image
0

Answer by Taylor-Libonati · May 26, 2016 at 11:14 PM

I would suggest making the center of your transform that has the rigid body be at the tip of the spear and having. Also it could be a problem with the script that is handling the throwing. Did you write your own throwing code or use someone else's?

Comment
Add comment · Show 2 · 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 Taylor-Libonati · May 27, 2016 at 12:20 AM 0
Share

And add more mass

avatar image Zmurowski · May 27, 2016 at 08:05 AM 1
Share

Yeah the rotation was the fault of the script - I noticed that it passed the controller angular velocity to the object on throw.

I'll try adding more mass to it.

Cheers

avatar image
0

Answer by Ivan-WIdyan · Nov 30, 2016 at 07:36 AM

Maybe you can give clamp function for the spear? So it's not rotate many times like in your picture

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.

Follow this Question

Answers Answers and Comments

8 People are following this question.

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

Related Questions

I'm having trouble making good throwing physics for a VR game 0 Answers

how can i attach a ragdoll to my vr controllers,attaching a ragdoll to vr controllers, ragdoll is behaving sparaticaly 0 Answers

Object movement choppy when picked up in VR 1 Answer

Can't move object in VR if it has children 0 Answers

Throw a weapon in a physics arc with a lead to a target? 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