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 lucamegh · Aug 01, 2014 at 02:35 AM · c#physicstouchswipe

Reproducing the "spin" effect of Flick Kick Football

If you are into mobile games you probably played Flick Kick Football at least once; if you haven't here are the links https://itunes.apple.com/us/app/flick-kick-football/id376481969?mt=8 https://play.google.com/store/apps/details?id=com.pikpok.fks

Once you hit the ball with the finger, if you are quick enough, you can adjust the ball's trajectory with a swipe gesture. I've already implement the simple kicking mechanism with the AddForce method. I've already tried using the same AddForce method to reproduce the spin effect but the result is quite unrealistic. Do you have any suggestion for its implementation?

Here's my current Update method:

 void Update () 
     {
         if (Input.touchCount == 1) 
         {
             Touch touch = Input.GetTouch(0);
             Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
             RaycastHit hit;
             
             v3 = Input.GetTouch(0).deltaPosition * Input.GetTouch(0).deltaTime;
             v3.Normalize();
 
             if (Physics.Raycast(ray, out hit) && hit.transform == transform)
             {
                 float positionDifference = Mathf.Abs(Input.GetTouch(0).deltaPosition.magnitude);
 
                 if (positionDifference > minimumDrag)
                 {    
                     transform.rigidbody.AddForce(new Vector3(v3.x * 30.0f, v3.y * 30.0f, 26.0f) * flickForce);
                 }
             }
         }
     }

Thank you very much :)

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 robertbu · Aug 01, 2014 at 02:40 AM 0
Share

I've found simulating the $$anonymous$$agnus effect (the curve of a spinning ball) best done by adding a small amount of force every frame.

http://answers.unity3d.com/questions/377944/how-to-make-a-ball-rotate-as-per-its-moving-direct.html

The direction of the swipe gives you the axis of rotation (and therefore the direction of the curve), and the velocity of the swipe gives you the speed of the curve.

avatar image robertbu · Aug 13, 2014 at 06:31 PM 0
Share

@lucamegh - you just edited your question (I assume to bring it back to the top of the queue). Did you try what I suggested?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Khalid-Mahmood · Jan 23, 2016 at 12:23 AM

http://answers.unity3d.com/questions/377944/how-to-make-a-ball-rotate-as-per-its-moving-direct.html @lucamegh

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Detect swipe up gesture IOS 1 Answer

Make Swipe Detection Longer? 0 Answers

multi touch / swipe issues 5 Answers

Multiple Cars not working 1 Answer

How can I make my player air dash using velocity toward a target more consistent? 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