Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 malaka · Dec 12, 2012 at 01:22 AM · gunremote

Using a real game gun

Hi

I want to make a target game, similar to Duck Hunt but even more simple. Just a grid of squares on the screen, if I hit one with the right color then it would count as a hit. Is there a gun I can buy and program for Unity that would detect the colours I shoot at, or is there another way to do this?

Comment
Add comment · Show 4
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 john-essy · Dec 12, 2012 at 01:25 AM 0
Share

What you want my friend is Raycast, You can use this to detect what ever has been hit, even a materials color.

http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html

avatar image T27M · Dec 12, 2012 at 01:52 AM 0
Share

I think he means he wants the controller to be a gun.

avatar image malaka · Dec 12, 2012 at 02:25 AM 0
Share

Yeah exactly, a physical real gun controller.

avatar image T27M · Dec 12, 2012 at 02:38 AM 0
Share

I would assume that any gun controller would come with drivers that would control the input and the keys could be mapped to any existing ones. You may have to get yourself a cheap USB one and have a play around.

1 Reply

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

Answer by ZorNiFieD · Dec 12, 2012 at 02:38 AM

http://wiki.unity3d.com/index.php?title=UniWii

Everyone has access to a wii remote, so why not just use one of those?

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 malaka · Dec 12, 2012 at 02:47 AM 0
Share

How would this work though. What sensors on the remote would detect if you are actually pointing on the target?

avatar image ZorNiFieD · Dec 12, 2012 at 02:55 AM 0
Share

I wrote a really long response, then lost it on submit. =/

Think of the wiimote as just like any other input in unity, cursor, keyboard or otherwise. The wiimote would use the following properties to obtain current position:

wiimote_getAccX(int which) wiimote_getAccY(int which) wiimote_getAccZ(int which) Returns the raw values for Wiimote accelerometer for each axis. The return value is a byte, so the rotation values can be from 0 to 255.

You will need to use Raycasting to achieve what you want as john essy stated. I recommend going to youtube for that ins$$anonymous$$d of reading the documentation as there are literally thousands of tutorial videos on the subject matter. Here's a search that will start you in the right direction:

http://www.youtube.com/results?search_query=unity+accelerometer+raycast&oq=unity+accelerometer+raycast

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

12 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

Related Questions

Bullets getting stuck in air 1 Answer

JavaScript - FireMode Toggle Help 1 Answer

Need help with gun script to reduce the gun's rate of fire 1 Answer

Gun movement 1 Answer

Problem with "if" statements 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