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 Jeeva3m · Jun 10, 2015 at 07:17 PM · animationanimationcliptouchespinch

How to play animation based on Pinch in/out values?

Hi, I have a 3D object which has 2 Animation clips (Explode/Implode). Each clip is about 60 frames. Now when i do Pinch-in on my mobile-touch, Explode animation clip should play according to how much i pinched-in (Based on the pinch value, need to play the animation clip-frames).

If i moved the two fingers little, then the animation also should be played little. Vice-versa for Pinch-out for Implode animation. And the animation should stop playing when the fingers are off.

Could you please help me or give a tip on how to synch the pinch value and animation clip's frames.

Thanks

Jeeva

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 Jeeva3m · Jun 11, 2015 at 07:19 AM 0
Share

When i said Explode/Implode, I dint mean about Explosion (particles). I meant about assemble and disassemble. Herewith attaching Sample Explode/Implode Images.

alt textalt text

explode.png (30.4 kB)
implode.png (15.9 kB)
avatar image Jeeva3m · Jun 19, 2015 at 12:45 PM 0
Share

Could anyone help me in this please??!!!

avatar image Jeeva3m · Jun 22, 2015 at 05:57 AM 0
Share

Waiting for your help...

Thank you!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by abi-kr01 · Jun 22, 2015 at 02:30 PM

 As far as i i know animation play in full length like when i say gameobject.animation.play("Explode"); it will play the the animation .if you pause the animation it will pause but replay will be from start.
     there are two ways we can do that 
     1)If its only a placement thing we can use Lerp for that 
     2)divide the animation in several parts and run them differently 

Comment
Add comment · Show 4 · 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 Jeeva3m · Jun 24, 2015 at 06:06 AM 0
Share

Hi abi.kr

Thanks for your valuable time and reply, I am trying to use Lerp only. I dint get still. Let me try.

avatar image abi-kr01 · Jun 25, 2015 at 03:47 PM 0
Share

did you solve the problem

avatar image Jeeva3m · Jun 26, 2015 at 05:44 AM 0
Share

Hi abi.kr01,

Thanks for your concern. I have not yet solved the problem. I am just following the tutorial,

https://cgcookie.com/unity/lessons/3-detecting-2-finger-gestures/

by $$anonymous$$ Bilz for pinch in/out. $$anonymous$$y script now looks something like this:

function Update () {

 if(Input.touchCount == 2 && Input.GetTouch(0).phase == TouchPhase.$$anonymous$$oved && Input.GetTouch(1).phase == TouchPhase.$$anonymous$$oved)
 {
     v2_current = Input.GetTouch(0).position - Input.GetTouch(1).position;
     v2_previous = (Input.GetTouch(0).position - Input.GetTouch(0).deltaPosition) - (Input.GetTouch(1).position - Input.GetTouch(1).deltaPosition);
             
     f_touch_delta = v2_current.magnitude - v2_previous.magnitude;
     
     animGO.animation.enabled = true;
     animGO.animation["Assemble"].time = 0;
     animGO.animation["Disassemble"].time = 0;
     
     if($$anonymous$$athf.Abs(f_touch_delta) > f_comfortZone)
     {
         //zoom in
         if(f_touch_delta>0) //changing everyframe
         {                
             if(animGO.animation["Disassemble"].time <= disTF)
             {
                 if(isPlaying == false)
                 {
                     animation["Disassemble"].time = $$anonymous$$athf.Clamp($$anonymous$$athf.Lerp(animation["Disassemble"].time, animation["Disassemble"].time - $$anonymous$$athf.Abs(f_touch_delta), Time.deltaTime),0,50);
             
                     animation["Disassemble"].speed = 1;
                     animation.Play("Disassemble");    
                     isPlaying = true;    
         
                 }                    
             }                
         }
         else
         {
             if(animGO.animation["Assemble"].time <= assTF)
             {
                 if(isPlaying == false)
                 {
                     animation["Assemble"].time = $$anonymous$$athf.Clamp($$anonymous$$athf.Lerp(animation["Assemble"].time, animation["Assemble"].time + $$anonymous$$athf.Abs(f_touch_delta), Time.deltaTime),0,50);
                 
                     animation["Assemble"].speed = 1;
                     animation.Play("Assemble");    
                     isPlaying =true;                    
                 }                    
             }                
         }            
     }
avatar image Jeeva3m · Jun 26, 2015 at 05:47 AM 0
Share

I am just trying to pass the value to -> animation["ClipName"].time by clamping and lerp, using the touch $$anonymous$$agnitute (touch_delta) and animation time.

Not getting as expected though. thanks

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

Unity Animator cant play the same animation twice. 2 Answers

Character won't run straight 1 Answer

Single Animation file for two different objects! HELP! 1 Answer

Checking animation playing in ieunmerator. Is there a better way to do this? 1 Answer

Make Animation Loop X Times C# 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