如何在Unity中的2D画布上播放3D动画 [英] How to play 3D animation on a 2D canvas in Unity

查看:612
本文介绍了如何在Unity中的2D画布上播放3D动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢在Canvas上播放动画.

I like to play animation on a Canvas.

我制作了一个画布,如下图所示.

I made a canvas as shown in the following image.

我喜欢在绿色画布上播放高尔夫球手动画. 有可能吗?

I like to play a golfer animation on the green color canvas. Is it possible?

我有第二个图所示的动画模型.

I have animation model as shown in the second figure.

我喜欢在画布上播放高尔夫球手的动画. 我怎样才能做到这一点? 我将画布作为子对象拖放到画布下,这是行不通的.

I like to play that golfer animation on the canvas. How can I do that? I drag and put under canvas as child object, it doesn't work.

推荐答案

正如我在评论中所解释的,我将按照以下说明进行操作:

As I explained in my comment, I would do as follow :

  1. 将您的对象放置在特定的图层中(在示例中称为MyLayer)
  2. 相机的Culling mask设置为仅渲染此特定图层
  3. 取消选中相机的Culling mask中的MyLayer,以防止后者渲染您的模型
  4. 将摄像机的Clear flags设置为Depth only以防止后者渲染天空盒
  5. 在您的项目中创建一个新的渲染纹理,然后将&将其放置在新相机的Render Texture字段中
  6. 将新的原始图像添加到您的UI画布并分配渲染Texture字段中的纹理
  7. 运行3D动画
  1. Put your object in a specific layer (called MyLayer for the sake of the example)
  2. Set the Culling mask of a new camera to render only this specific layer
  3. Uncheck the MyLayer in the Culling mask of your main camera in order to prevent the latter to render your model
  4. Set the Clear flags to Depth only of the camera to prevent the latter from rendering the skybox
  5. Create a new Render texture in your project, and drag & drop it in the Render Texture field of your new Camera
  6. Add a new Raw Image to your UI canvas and assign the render texture in the Texture field
  7. Run your 3D animation

您的相机会将动画渲染到UI上的图像中

Your camera will render the animation into the image on your UI

这篇关于如何在Unity中的2D画布上播放3D动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆