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 /
avatar image
0
Question by Ed · Mar 23, 2010 at 10:39 PM · iphoneiphonetouch

iphone bullet through paper problem

I am using the iPhone and I have a problem tracking my finger movement. I have a sprite on screen and when I touch the sprite I want it to move where ever my finger moves. The problem is that I am moving my finger too fast and the script I wrote doesn't refresh enough to catch this case. Right now the script is FixedUpdate() function. Would the script update faster in the Update() function? Any help would be appreciated.

here is my code:

function Update() {

if(iPhoneInput.touchCount == 1 && iPhoneInput.GetTouch(0).phase == iPhoneTouchPhase.Moved) {

oneThrow.ray = Camera.main.ScreenPointToRay(iPhoneInput.GetTouch(0).position);

oneThrow.OldPosition = oneThrow.gameObjectGuy.rigidbody.position;

if(collider.Raycast(oneThrow.ray, oneThrow.mrHit, 1200)) {

//test code that occures when the ray has collided with //the booger

Debug.DrawLine(oneThrow.ray.origin, oneThrow.gameObjectGuy.transform.position , Color.red);

//end test code

//code oneThrow.StopChangeFromRandom = true; oneThrow.WalkLeft = false; oneThrow.WalkRight = false;

oneThrow.PackedSprite.defaultAnim = 2; oneThrow.PackedSprite.PlayAnim("Idle");

print("Ray Direction " +oneThrow.ray.direction+ "!!!");

oneThrow.gameObjectGuy.rigidbody.position = Vector3((oneThrow.mrHit.point.x), (oneThrow.mrHit.point.y), (oneThrow.mrHit.point.z));

}

oneThrow.rayValue = oneThrow.ray.direction.x; print("rayValue = " +oneThrowr.rayValue+ "!!!"); }

}

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

1 Reply

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

Answer by qJake · Mar 24, 2010 at 02:32 AM

Yes - your script will (most likely) update faster using just Update(). Why not just try it instead of posting here? It's not like your iPhone will explode if you substitute one for the other ;) Don't forget to use Time.deltaTime for any movement calculations.

If your finger is still moving too fast, and you still need to detect collisions, I would suggest drawing a Linecast between the two positions of the object and checking collisions that way.

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 Ed · Mar 25, 2010 at 09:47 PM 0
Share

That fixed it up good. I forgot about the Time.deltaTime. Thanks man.

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

No one has followed this question yet.

Related Questions

Block UnityGUI Hit 1 Answer

Add impulse force using input.touch 0 Answers

How do I enable iAds on my unity game for iPhone? 0 Answers

Unity iPhone scene transition on Tap of GUIText 1 Answer

Pokemon clone touch movement. 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