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
2
Question by TomWheldon · Jun 04, 2013 at 07:43 PM · collideronmousedownclickable

Clickable area problem?

I've had a crack at making my first game.

You can see it HERE as it might give you a bit more insight in to my question.

When you click on the game case it issues the OnMouseDown function and from there I run all my little functions. Everything works ok for me.

Now people on slower computers have a problem clicking, its a little hit and miss... some times it works and some times it doesnt even if they did click it perfect.

I've also exported it to android and my super fast Nexus 10 allows me to click them fine, but a slower Galaxy 2 doesn't

I just wanted to know how would I get around this?

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 robertbu · Jun 04, 2013 at 11:05 PM 0
Share

I played a bit with your game and also did a quick mock-up of the block rolling/falling in Unity to test was is going on. I'm running on a fast machine. If I lead the block a bit clicking in front of the block I often/usually get a hit. If I try and catch the trailing edge of the block, I usually don't get a hit even when I click on the block. I have a theory.

Between the time the block is displayed for the previous frame and the time I process the mouse click, one or more "FixedUpdate()/Physics" calculation passes have been made, moving the location of the block. So by the time you process the On$$anonymous$$ouseDown(), the visual of the block is behind the physical representation (by one frame). And the slower the machine, the slower the frames per second, and the more out of sync the visual and the physical become.

You can test this theory by significantly leading the block when you do the click/touch on a slow machine. If I'm right, you should get more hits.

If this is the problem, I'm not sure how to fix it. I have a couple of hacks in $$anonymous$$d, but I'd love to hear from someone with more experience with the physics engine.

avatar image TomWheldon · Jun 05, 2013 at 08:29 AM 0
Share

That does sound like this could be the issue, I was going to add an extra box (not rendered) behind the game cases for "overspill", but this sadly would make the game too easy for people on fast computers...

avatar image robertbu · Jun 05, 2013 at 02:26 PM 0
Share

I was hoping someone with more physics experience would comment. I can think of a bunch of untried hacks. For example, you could offset the collider back to the previous frame position until it collides. Or have a second game object with a collider of the same size. You could position it at the position in the previous fame and then do a raycast.

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

14 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

Related Questions

BoxCollider 2D not working OnMouseDown() 1 Answer

OnMouseDown (Collider other) Not working 1 Answer

OnDestroy collision detect 4 Answers

Activating only when mouse is held down on a button for 0.5s. 1 Answer

Collider OnMouseDown movement lag 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