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

相关推荐
老K(郭云开)5 小时前
最新版Edge浏览器集成ActiveX控件之金山WpsDocFrame控件
前端·javascript·chrome·3d·中间件
helloyangkl6 小时前
3dtiles——Cesium ion for Autodesk Revit Add-In插件
3d
威斯软科的老司机6 小时前
3D图形学与可视化大屏: 3D 图形学的定义、应用领域和发展历程
3d·计算机图形学
Unity官方开发者社区11 小时前
吉祥汽车泰国首发,用 Unity 实现行业首创全 3D 座舱虚拟世界
3d·unity·汽车
春末的南方城市1 天前
Stability AI 联合 UIUC 提出单视图 3D 重建方法SPAR3D,可0.7秒完成重建并支持交互式用户编辑。
人工智能·计算机视觉·3d·aigc·音视频·图像生成
Vesper142 天前
《只狼》运行时提示“mfc140u.dll文件缺失”是什么原因?要怎么解决?
windows·经验分享·游戏·电脑
mm_exploration2 天前
halcon三维点云数据处理(十四)在3D场景中去除背景的三种方式
图像处理·3d·halcon·点云处理
海鸥-w2 天前
Untiy3d 铰链、弹簧,特殊的物理关节
android·3d
mm_exploration2 天前
halcon三维点云数据处理(十三)reduce_object_model_3d_by_view
图像处理·3d·halcon·点云处理