Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Youngapprentice · Dec 04, 2011 at 11:03 PM · transformprefabposition

Checking Position

*Skip to bolded text for question

Hi, all! I have a very curious problem on my hands that I hope can be solved. :) I am trying to do a Guitar Hero / Rockband type thing. I have Unity Indie (Free ;P )so instead of using 3D elements, I am using Blender to model 3D elements, and render them and then use them as GUI Textures in game. That's the just of it.

So I am tweening the pegs through the fingerboard because the fingerboard is not perfectly straight (perspective) and scaling the sprites for the peg-things accordingly (because they are GUITextures) Please tell me if I am being unclear with this.

My problem is that I need to implement the scoring system. In a traditional Guitar Hero game, if you hit a button and a peg is not on the button then you lose points and you gain points by hitting the respective button on the guitar for each peg if they are on the button on the screen. My problem is that I do not know how to do this exactly. I need the camera to check if any spawned peg's y value is between two floats in their y position on-screen when a key press occurs.

The problem is, I am using prefabs, so I do not know how to make the camera gather all of the objects that are belonging to the prefab, finding the one in the lead, and then checking it's position and acting accordingly.

That is my question. Sorry if this was too long :) any help is appreciated. Oh and I'm using Javascript for my coding.

Thanks!- YA

Comment
Add comment · Show 2
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 ByteSheep · Dec 06, 2011 at 06:42 PM 0
Share

Perhaps a screen shot would be helpful, showing how the fingerboard is placed etc.

avatar image Youngapprentice · Dec 17, 2011 at 04:53 AM 0
Share

BU$$anonymous$$P Guys I still need some help here

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by fafase · Dec 17, 2011 at 08:06 AM

Here is how I would do it but it might not be the best:

You would have a hitline position that is your hit point, the one at the bottom of the screen. Then you check your prefab position and at the same check which button is hit.

In a way it would go,

 If(colorbutton is pressed)
     if(distance(prefab, hitline)<range)
          point+=score
     else   point-=score

you can also make it more accurate with more if statement depending on the distance using

 if(distance(prefab,hitline)<maxrange && distance(prefab,hitline)>minrange) 

this way the closer to the hitline the more point you get.

It might not be the solution but it could be a start.

Good luck

Comment
Add comment · Show 1 · 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 Youngapprentice · Dec 17, 2011 at 03:14 PM 0
Share

Thank you for the reply. The help is appreciated. Unfortunately, I had already gotten this far before I went to the community for answers. I have the whole system set up much like you have it. $$anonymous$$y issue is that if there are more tan one button of the same color on the scene at once, and I press a button when the first on is on the hit line, I will gain a point, but I will also LOSE a point, because the one behind i also runs the script, hence my problem.

Does anyone have any extremely clever workarounds?

Thanks! - YA

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Grab position from instantiated object 1 Answer

Vector3 Transform.Position Not Working 2 Answers

platforme ...HELP!! POSITION ADDING 1 Answer

How do I check if an Object isn't moving? (C#) 1 Answer

Can't move instantiated prefab 2 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