Git Product home page Git Product logo

animator's Introduction

EX NO 6 Animator

Aim:

To develop a animator using unity with C# prgram and move the animator.

Algorithm:

Step 1:

Download 2 crouch idle from maximo 3d. Drag it and drop it in unity asset.

Step 2:

Select one crouch and in the inspector choose rig-> Animation type (humaniod) and then click update.

Step 3:

Perform the step 2 for another crouch

Step 4:

Select one crouch and in the inspector choose Animation-> Root transform rotation-> Based upon (original) and check the Loop Time and click apply

Step 5:

Perform the step 4 for another crouch

Step 6:

Drag one crouch, put it in hierarchy and name it as Player.

Step 7:

In the Player inspector we have Animator. Right click in Assets-> create -> Animator Controller (name it as IdleToCrouch)

Step 8:

Drag the IdleToCrouch to the Controller option under the Animator in the inspector. Click that IdleToCrouch , a window opens and select parameter tab , create 2 parameter, InputX and InputY

Step 9:

Select the another crouch and attach with Entry button and name it as movement. Right click it and choose create blend tree.

Step 10:

Click the movement button, blend tree opens. Choose InputY in parameter and under the motion click โ€˜+โ€™ sign and choose add the motion field twice.

Step 11:

Drag the second crouch and put it motion field, then drag the first crouch and put it in the another motion field.

Step 12:

Uncheck the automata threshold and change the values -1 and 0 in first column( priority for the crouch). Create a C# file and name it as IdleToCrouch, drag it to the player

Step 13:

Download a walking crouch from maximo 3d and drag it into unity. In the inspector select rig-> animation types(humanoid) -> Apply

Step 14:

Select the crouch and in the inspector choose Animation-> Root transform rotation-> Based upon (original) and check the Loop Time and click apply

Step 15:

In blend tree, in blend type choose (2D Freedom Directional), parameter (InputX, InputY) , one crouch (0,-1,1) and walking (1,0,1). Bring the camera under the player

Program:

NAME: A K MOHAN RAJ
REG NO :212221230064

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class IdletoCrouch : MonoBehaviour
{
    public Animator animator;
    public float InputX;
    public float InputY;
    
    // Start is called before the first frame update
    void Start()
    {
        animator = this.gameObject.GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        InputX = Input.GetAxis("Vertical");
        InputY = Input.GetAxis("Horizontal");
        animator.SetFloat("InputX", InputX);
        animator.SetFloat("InputY", InputY);
    }
}

Output:

Idle Position Crouch/Moving Position
image image

Result:

Thus, the animator was successfully developed in unity engine with the C#.

animator's People

Contributors

archanasharikalharinarayanan avatar mohan8900 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.