untiy3D为游戏物体制作简单的动画

1.创建一个物体挂载动画组件Animator

2.创建一个动画控制器

3.动画控制器挂载到Animator组件

4.创建动画窗口>动画

入口默认执行left

执行效果

20250212_151707

脚本控制动画

鼠标点击是切换到动画t

csharp 复制代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class test : MonoBehaviour
{


    private Animator animator;

    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {

        // 获取动画器组件
        animator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {

        if (Input.GetMouseButtonDown(0)) {

            animator.Play("left");

        
        }


        
    }
}

效果

20250212_152204

相关推荐
Software攻城狮8 小时前
8 【 entity ,primitive,3D tiles 3者的含义和区别】
数码相机·3d
凯基迪科技12 小时前
Unity游戏加密锁逆向方案、选型与攻防分析
游戏·unity·游戏引擎
Solange__12 小时前
航天科普怎么用AI生成3D场景?从科学约束、尺度分层到网页展示的完整方案
图像处理·人工智能·游戏·3d·ai·自然语言处理·关卡设计
Carl_奕然14 小时前
【机器视觉】最强算法之:3D高斯泼溅(3D Gaussian Splatting)
人工智能·python·算法·目标检测·计算机视觉·3d
河图洛水19 小时前
UniDex-VLA:用人类第一视角视频,训出能跨 8 种灵巧手的 3D VLA
3d·大模型·具身智能·vla·ego
C MIKE20 小时前
小熊杂货铺小游戏开发
游戏
云飞云共享云桌面20 小时前
苏州半导体工厂研发部门多个SolidWorks 如何共享服务器来进行研发设计
运维·服务器·3d·自动化·制造
坚定信念,勇往无前20 小时前
3d建模整个流程-完整工作流总结(Maya + Marmoset Toolbag 八猴 + Substance Painter + Unity URP)
3d
FansAI_art21 小时前
3D潮玩手办的材质还原与多角色同屏防崩坏
3d·材质
Solange__21 小时前
AI模型编辑器、Blender和3D Agent怎么选?按5类修改任务比较局部编辑、拓扑与自动化
人工智能·3d·自然语言处理·编辑器·音视频·blender·游戏策划