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

相关推荐
一根数据线19 小时前
不用无人机也不用软件,AI也能直接从地图生成3D模型?
人工智能·3d·3d建模·无人机·倾斜摄影·造形家·场地建模
极客侃科技21 小时前
游戏本办公两用笔记本推荐,来酷斗战者 战7000P 酷睿版兼顾两种需求
游戏
ownkss1 天前
游戏买量素材测试方法:核心逻辑、执行步骤与关键指标
游戏
dalong101 天前
WPF:3D网格构建和渲染的三个核心
3d
山东布谷网络科技1 天前
靠“社交+游戏”突围:中东语聊APP前景预测与低成本运营案例
人工智能·游戏
dalong101 天前
WPF:3D顶点共享与法线设置对光照效果的影响
3d·wpf
摩尔线程2 天前
摩尔线程LiteGS入选ECCV 2026 高质量3DGS训练迎来效率突破
3d·摩尔线程
郝学胜-神的一滴2 天前
[简化版 GAMES 104] 现代游戏引擎 04:从0到1构建你的游戏世界
c++·游戏·unity·游戏引擎·软件工程·unreal engine
灼灼其华tzl2 天前
飞机大战游戏1
游戏
LateFrames2 天前
CT(DCM)外轮廓实时识别 → 逐层拼3D → 导出STL到Blender
图像处理·3d·可视化·医疗·ct重建