Question by
Mrmeower855 · Aug 19, 2016 at 06:55 AM ·
3d3d models3d model
How do I play 3d animations?
I am pretty new to unity, and I have been looking over the internet and messing with my code for about 7 hours now, but I just can't seem to figure out how to play an animation. This is my script, and anything else I need to do outside my script would be nice to know. Thanks!
using UnityEngine;
using System.Collections;
using UnityEditor;
public class SwingC : MonoBehaviour {
Animator anim;
int Attack = Animator.StringToHash("Attack1");
// Use this for initialization
void Start () {
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown(0)) {
anim.SetTrigger (Attack);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Google Maps Platform Integration 0 Answers
How do I put on a manual collider onto a 3D modeled asset? 1 Answer
C4d to Obj file conversion 0 Answers
The player gets fly in air. 0 Answers