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 Redjinator · Oct 26, 2016 at 05:46 AM · inputvr

Can SteamVR trigger simulate Fire1?

Hello, I normally figure out my own problems simply by searching around the internet but I'm bashing my head on the wall right now after hours of searching.

I have an old game I'm trying to convert to VR, and i need my Vive triggers to simulate mouse buttons true for the following if statements to fire the weapons that are children to the vive controllers. The script this code is in, is attached to the weapons themselves not the controllers. And the code is in update ()

 if (fireTimer >= actualROF && burstCounter < burstRate && canFire)
             {
                 if (Input.GetButton("Fire1"))
                 {
                     if (!warmup)    
                     {
                         Fire();
                     }
                     else if (heat < maxWarmup)    
                     {
                         heat += Time.deltaTime;
                     }
                 }
                 if (warmup && Input.GetButtonUp("Fire1"))
                 {
                     if (allowCancel && Input.GetButton("Cancel"))
                     {
                         heat = 0.0f;
 
                     }
                     else
                     {
                         Fire();
                     }
                 }
             }


Currently everything runs fine except I still need to click the mouse to fire. I've tried using

 SteamVR_TrackedController controller;
 
 void Start () {
     controller = GetComponent<SteamVR_TrackedController>();
     if (controller == null)
     {
         controller = gameObject.AddComponent<SteamVR_TrackedController>();
     }
     controller.TriggerClicked += new ClickedEventHandler(SimulateMouse);
 }
 
 void SimulateMouse(object sender, ClickedEventArgs e)
  {
             //Somehow simulate a mouse click?
 }

To no avail as I couldn't figure out what to put in SimulateMouse... I swear I've looked all over and maybe the answer is under my nose, if so I apologize for the double post.

Thanks for reading.

Comment
Add comment · Show 1
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 Redjinator · Oct 30, 2016 at 07:12 AM 0
Share

Still no advice? It's been a few days since I've posted this, any help would be great.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Gamepad stops working with Oculus Rift attached 0 Answers

Input Injection 0 Answers

How can i get the oculus quest 2 input in unity? 1 Answer

Google daydream problem input controller 1 Answer

No input from vr controllers, but they still track. Both for Vive and Index controllers 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