How do give an animation to a 3D object?

Not favoritedFavorited Favorited 0 favourites
  • 9 posts
From the Asset Store
Template for a basketball game with a 3D aspect (illusion of 3D)
  • I'd either need to give an animation to a 3D object, or have a way to stand up a normal sprite. Is there any way to do either of these things?

  • Which 3D object are you referring to?

    If it's a 3D model, the animation should already be embedded in the model; you just need to open it and play it.

    If it's a 3D shape, you can assign a sprite to a face and then play the animation on that sprite.

  • To prop up a sprite in 3d it will require a 2x2 mesh distort and some math.

    You’d start with an unrotated sprite with a 2x2 mesh distort.

    Steps to do it for each corner is:

    1. Get corner position

    2. Subtract object center

    3. Rotate 90 on xz plane

    4. Rotate on the xy plane towards the direction you want to face

    5. Set the mesh point. But you have to divide x by sprite.width and y by sprite.height.

    The math for xy rotation of a point is:

    Rotx = x*cos(a)-y*sin(a)

    Roty = x*sin(a)+y*cos(a)

    Xy rotation is similar. Just replace y with z in the above formulas.

    In the end all those steps can reduce down to a relatively compact formula.

    But if following a math recipe isn’t your thing, you’ll have to wait till I have time to bake an example at a later date.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Which 3D object are you referring to?

    If it's a 3D model, the animation should already be embedded in the model; you just need to open it and play it.

    If it's a 3D shape, you can assign a sprite to a face and then play the animation on that sprite.

    A 3D shape, I just put a 2D sprite on a 3D shape, I expected to be able to animate it.

  • To prop up a sprite in 3d it will require a 2x2 mesh distort and some math.

    You’d start with an unrotated sprite with a 2x2 mesh distort.

    Steps to do it for each corner is:

    1. Get corner position

    2. Subtract object center

    3. Rotate 90 on xz plane

    4. Rotate on the xy plane towards the direction you want to face

    5. Set the mesh point. But you have to divide x by sprite.width and y by sprite.height.

    The math for xy rotation of a point is:

    Rotx = x*cos(a)-y*sin(a)

    Roty = x*sin(a)+y*cos(a)

    Xy rotation is similar. Just replace y with z in the above formulas.

    In the end all those steps can reduce down to a relatively compact formula.

    But if following a math recipe isn’t your thing, you’ll have to wait till I have time to bake an example at a later date.

    This one... I just have no idea what you're talking about. 2x2 Mesh distort? I can't find that on behaviors or objects or anything. Any mesh options I'm seeing on the event sheet have nothing to do with rotation. And looking at the object properties I don't see anything about the mesh either. What am I missing? Is there a good tutorial for this?

  • A 3D shape, I just put a 2D sprite on a 3D shape, I expected to be able to animate it.

    It is possible; there are many examples in Construct 3, and here's another one.

    fex.net/s/zsfcr0r

  • > A 3D shape, I just put a 2D sprite on a 3D shape, I expected to be able to animate it.

    It is possible; there are many examples in Construct 3, and here's another one.

    https://fex.net/s/zsfcr0r

    Very easy, I didn't realize what I was looking at before. I haven't made a 3D game on here yet. Thank you.

  • Very easy, I didn't realize what I was looking at before. I haven't made a 3D game on here yet. Thank you.

    It's very useful to add a “TiledBackground” to a “3Dshape”; this allows you to scroll through the tile itself, creating a moving surface on the cube—such as water or a tank track.

  • Mesh is a feature that lets you divide an object into a 2d grid of points that you can move around to distort it. You can right click on most objects in the editor to create a mesh and visually drag the points around. You can also do it with events. For example under sprite actions there's a "set mesh" and "set mesh point" actions. I refer to it as a mesh distort but maybe searching for the word "mesh" may help you find documentation or tutorials.

    I like the simplicity of just setting a face to use a sprite texture. However if you have animations with different sized frames or different origins per frame it won't look great. You could probably correct that by resizing and moving the shape per frame to compensate though.

    However I wasn't pursuing the 3dshpe method. Here is a Mesh distort method that keeps the frame origins and frame sizes.

    dropbox.com/scl/fi/8eod773bnyxw9z0wjba1k/3dRotate_sprite_mesh.c3p

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)