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 stevenp · Feb 17, 2012 at 08:35 AM · collisioniphonetouch

iPhone - Collision sometimes not detected when swiping too fast

Hi guys!

I'm making a slicing game using Raycast but when I swipe across the object too fast, the collision sometimes didn't take place. I couldn't find any definite solution to this. I applied a Trail Renderer to show the slicing effect and the effect showed clearly that the swiping takes place across the object. Is it because of the collision method? I tried changing the collision detection in the object Rigidbody properties to Discrete, Continuous, and Continuous Dynamic but there seems to be no difference. I appreciate any tips and advice related to this problem.

Another thing, is it normal for the game to run on 30 frame per second on iPad 2?

Thanks in advance =)

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
0

Answer by reptilebeats · Feb 17, 2012 at 02:40 PM

If ur only using oncollision enter try using stay instead, enter can be a bit finiky for some things, if not try all 3 enter exit stay. Also are u just testing on emulater or actually putting it on ur phone. U got to take in consideration of the lag time

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 stevenp · Feb 20, 2012 at 01:52 AM 0
Share

Sorry for late reply. I'm not using OnCollisionEnter, I'm using RaycastHit because my game is 2D and it's just shooting objects with a tap. Looked for solutions and it seems RaycastHit is the best option for my case. I don't think the game lag at all. I tried spawning 20 objects at once and it is still fine. The fps is 30 and I feel it's a bit slow because I'm pretty sure 60 fps is the best number for a game.

avatar image
0

Answer by stepan-stulov · Jun 13, 2014 at 10:41 AM

If you swipe too quickly, there is always a possibility that previous touch position is outside and in front of your gameobject and the current touch position is also outside but already behind your game object. Simply becayse the touch screen works descretely and cannot provide position data more frequently. I'm not sure if the described routine with colliders include continuous calculation, something tells me it rather doesn't.

What you have to do if you want a really nice smooth experience on very fast moves is to test whether the segment betwee the two most recent touch positions intersects the collider's/gameobject's screen projection.

It's similar to how collision prediction in physics works in case something flies to fast and in the current update is far before a wall, and in the next update is far after. Yet the hit is detected as they check whether the line between the two positions intersects the wall.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

iPhone touch raycasting 1 Answer

Unity iPhone: AddForce to Object after Touch 0 Answers

Input.GetAxis("Vertical") on touch devices. 2 Answers

How can I detect touch on anroid or iphone 2 Answers

Touch collision detection with a sprite 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