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 /
  • Help Room /
avatar image
1
Question by diggerjohn · Jan 15, 2018 at 09:46 PM · vrpointerlaser

Vive laser pointer turn off??

I have a scene where I am using SteamVR_LaserPointer.cs to pick an interactive object. Once the object is picked I am changing the scene. Just before I change scene I disable the SteamVR_LaserPointer.cs script.

But in the new scene the Laser Pointer is still there and visible on the Control and yet the Script for it is disabled.

Does anyone have any idea how I can turn this thing off??????? Thanks ....

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by mesadigitaldesign · Mar 01, 2019 at 05:14 PM

@diggerjohn greetings from the future! I just solved this one for myself in the SteamVR 2.2 package. It takes an alteration to the SteamVR_LaserPointer.cs script. In the Update() function, the first thing you see is this:

 if(!isActive)
 {
     isActive = true;
     this.transform.GetChild(0).gameObject.SetActive(true);
 }

This seems to do nothing, and forces the laser to always be on. Also, the "active" public variable appears to do nothing. Period. Instead, replace that isActive section to this:

 if(active != isActive)
 {
     isActive = active;
     pointer?.SetActive(isActive);
 }
 if(!isActive)
     return;

This allows you to actually turn the laser on/off by setting the public variable "active" to true or false. Alter to taste if you need other functionality to still be active when the visible laser is off.

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 sidwasnothere · Mar 22, 2019 at 07:55 PM 0
Share

Hey I realize I'm asking a question under a question here but none of the questions on this issue on Unity forums or S$$anonymous$$m forums are answered. How can you "click" an object using the Laser Pointer? I have a script on an object that does various things. I want to point the laser at the object, click my trigger button, and have the object read the clickdata by implementing the OnPointerClick(PointerEventData e) or OnPointerUp(PointerEventData e). Currently nothing happens when I do this

avatar image mesadigitaldesign sidwasnothere · Mar 23, 2019 at 04:00 PM 0
Share

I don't have my codebase with me right now, but I'll try to get you headed in the right direction. I solve it by slightly changing the perspective. Use a Raycast to look for an object, then tell the object that it was clicked.

There is a raycast going on inside the laser pointer code, but I didn't want to have my operational code inside a third-party script that still needs updates, so I wrote my own simplified input handler script that just does its own raycast from the appropriate hand transform when the trigger click is called. Here's the link to manual on doing that: https://docs.unity3d.com/ScriptReference/Physics.Raycast.html

Then you need to have a monobehavior on the object to react to being clicked. example, "$$anonymous$$yClass" with a function "Clicked". After doing the raycast and getting the "hit" variable, find that monobehavior object and activate it with this:

 $$anonymous$$yClass thing = hit.collider.GetComponent<$$anonymous$$yClass>();
 thing?.Cilcked(); // if it found one, call the function

avatar image
0

Answer by diggerjohn · Mar 23, 2019 at 01:22 PM

Hey guys thanks for tracking this. I am happy to say I SOLVED this little problem. I migrated to VRTK. It's solid. No worries about Steam updates braking my code any more. Strongly recommend it.

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

152 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

Related Questions

How to "click" an object using SteamVR Laser Pointer 0 Answers

OnPointerEnter 0 Answers

Making a laser pointer (reflection included) 0 Answers

How to make a laser pointer with WebXR 0 Answers

Making a laser pointer (reflection included) 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