4

I like to play animation on a Canvas.

I made a canvas as shown in the following image. enter image description here

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.

enter image description here

jps
  • 20,041
  • 15
  • 75
  • 79
batuman
  • 7,066
  • 26
  • 107
  • 229
  • 1
    You may need to render your object to a [Render Texture](https://docs.unity3d.com/Manual/class-RenderTexture.html) by a specific camera in order to display it to a [Raw image](https://docs.unity3d.com/Manual/script-RawImage.html) element – Hellium Oct 23 '17 at 13:03
  • @Hellium thanks, this 3D animation is purchased from asset store (https://www.assetstore.unity3d.com/en/#!/content/22253). Not quite sure how the animation was done. I am new to Unity, so is it possible to animate 3D animation on 2D canvas? – batuman Oct 23 '17 at 14:24

1 Answers1

7

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

  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

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

Hellium
  • 7,206
  • 2
  • 19
  • 49
  • Thanks, nice explanation. Let me try – batuman Oct 23 '17 at 14:54
  • you can either use rendertexture OR use a different camera alltogether and have that camera render on the screen in the appropriate place. this may be faster and provide you more easily with native resolution on the golfer. this may be easier since it looks like a mobile application anyways and it's in the center. you will also have to adjust which camera gets drawn first. – Lassi Kinnunen Oct 24 '17 at 09:15