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
0
Question by Oyshoboy · May 20, 2017 at 11:45 AM · unity 5physics

How to move Pistol Shutter in VR?

Hi Everyone! I have an issue, can't imagine how to make possible to slide pistol shutter, to reload/load gun in VR(Htc Vive)! I was trying to use colliders, and remember the first interaction point, and relatively to it calculate x movement and implement it to the shutter. So that's the question. Maybe anybody knows how to do it or already did ?

alt text

Thank you!

Comment
Add comment · Show 3
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 taxvi · May 20, 2017 at 11:56 AM 1
Share
  1. add trigger to the pistol shutter

  2. add trigger to the controller's tip

  3. once OnTriggerEnter let's you know the 2 triggers have crossed check if the button is pushed on the controller

  4. while the above 2 conditions are BOTH correct do the following: a. move shutter together with the controller (emulate grip) b. if the controller's trigger leaves the trigger on the shutter, OnTriggerExit - let shutter go back to rested position (emulate grip release)

EDIT: of course, the pistol is either still or controlled by another controller all the while

avatar image Oyshoboy taxvi · May 20, 2017 at 12:19 PM 0
Share

Thank you @taxvi , I guess it should work!

avatar image Artaani · May 20, 2017 at 01:14 PM 0
Share

What exactly a problem? You want to hold pistol in one hand and pull shutter using another hand?

You can get distance between hand and the shutter and when distance < some threshold, hold button and begin to move shutter to position of the hand (but only on 1 axis, ignore other 2 axis)

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Oyshoboy · May 20, 2017 at 02:11 PM

Everybody thanks for comments and advises, probles solved!

Here is the video demonstration: https://youtu.be/AxFI8FY5KSU

Solved it like this ( function must be called inside OnTriggerStay) :

     void CheckHandAndMove(Collider Coll) 
     { 
         //check if you using correct hand
         if (G17ItemScript.AttachedHand != null && Coll != null) 
         {
             // get steamVR component to detect trigger press
             ControllerCheckTrigg = Coll.transform.parent.GetComponentInParent<SteamVR_TrackedController>();

             // checking if trigger pressed 
             if (ControllerCheckTrigg.triggerPressed) { 
                 // Getting hand, which we need to follow
                 Follow = Coll.transform.parent.parent.gameObject;    



                // getting relative movement of hand to the shutter
                 HandRelativeTransform = transform.InverseTransformPoint(Follow.transform.position);  

                 // impmenent movement only for z axis ( using animation blend tree to be inside limits )
                 G17Animator.SetFloat("Blend", HandRelativeTransform.x * 20); 
             } 
         }
 
     }

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

157 People are following this question.

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

Related Questions

Collision work on pc emulator but not on android device 0 Answers

Excluding Vertices from Cloth Colliders in Unity 5 4 Answers

Ball with bounciness 1 bounces higher and higher in unity2d,Ball jumps higher and higher when bounciness set to 1 1 Answer

Softbodies in Unity 3D 1 Answer

Funfair simulation help 0 Answers


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