Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

edit animation inside animation window via script?

Discussion in '2D' started by PersianKiller, Feb 26, 2018.

  1. PersianKiller

    PersianKiller

    Joined:
    Jul 16, 2017
    Posts:
    114
    @Mecanim-Dev , do you think it's possible?

    i want to change rotation of an object via script.for example it's rotation should be 20 at frame 0,and it should be 60 at frame 6,but i want to be able to change it ,so if i have another gun for example m 16
    rotation should be 25 at frame 0 and at frame 6 it should be 40,
    when i use animation window,i can easily set rotation at frames but my problem is that each gun has a different rotation at start and end frames,if i can do something like this i can have only one idle animation for all of guns :)



     

    Attached Files:

  2. Thethispointer

    Thethispointer

    Joined:
    Feb 11, 2018
    Posts:
    105
    I don't have an answer, but I think I can help point you in the proper direction.

    Animations and Blend Trees (just think of these as more complex animations) can be controlled via parameters, and these parameters can be controlled via scripting. The update function in a game object can do something per frame of the game...

    With this all in mind I think you should look up tutorials on Animations and/or Blend Trees. What you're looking to do is likely more advanced, so the basic level stuff will probably be a bore...

    Either way, there is my thoughts. If they help you good. If they don't help, at least I tried!
     
    PersianKiller likes this.
  3. PersianKiller

    PersianKiller

    Joined:
    Jul 16, 2017
    Posts:
    114

    I'm going to watch them I hope they will solve my problem ,thanks a lot man :)

    ok i watched some tutorials ,but they couldn't help me ,because I don't want to create animation :) i want to play animtions via script.and i did it :) thanks a lot again i learned some good things from those tutorials about blend tree.
     
    Last edited: Mar 1, 2018
  4. Thethispointer

    Thethispointer

    Joined:
    Feb 11, 2018
    Posts:
    105
    Awesome good luck!