Animation and tweening

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
togFox
Party member
Posts: 779
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Animation and tweening

Post by togFox »

Not sure how to describe this one but my next project will be my first venture into 3D (or 2.5) and I intend to have, for example, a player controlled character swinging a sword around. This means different poses and stances and transitions between.

If this were 2D then I would make a sprite sheet and determine the correct sprite to display while tweening.

My 3D model won't have sprites - it will have multiple 3D objects moving through 3D space using matrix transforms (I hope). Whilst the starting pose and stopping pose is known - how to tween over multiple dt's?

If a sword, or points along the sword, moves from left to right then I should try to understand the mathematical formula (y=mx + c) so I can tween to any dt value along that formula?

Is that how it's done? Could the tweens also be determined via the same matrix transforms?!
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
marclurr
Party member
Posts: 105
Joined: Fri Apr 22, 2022 9:25 am

Re: Animation and tweening

Post by marclurr »

Smoothly animating in 3D is usually done using a skeletal rig. The rig configured so that certain bones deform specific parts of the mesh. The rig is then posed into key frames which are essentially 3D transforms, normally defined per bone relative to its parent bone. To get the position and rotation of any given bone you have to accumulate all the parents in the hierarchy. If you have enough key frames you can just cycle between them like a spritesheet but normally frames are interpolated between, which requires the use of quaternions to give correct looking rotations (IIRC G3D has a quaternion lib, could be imagining that). Finally you need to map the bone transforms to the relevant vertices in your mesh (or if your object is made of multiple chunks of separate geometry you can just apply to the relevant object I guess). It's a fairly complicated process start-to-finish but there are resources available. https://learnopengl.com/Guest-Articles/ ... -Animation is always linked when this question comes up so I'll do the same, though I've not read it myself.

I remember looking at the source code of that Horrible Hoarders game made using G3D framework and saw the developer made a very nice walk animation that fit their art style just using a bit of trigonometry so if you don't want to go that far down the rabbit hole you could always experiment with just simple procedural animation.

I'm sure I've missed some info or have some slightly wrong but no doubt someone will clarify anything. Hopefully that helps :)
User avatar
togFox
Party member
Posts: 779
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Animation and tweening

Post by togFox »

Thanks for that. It's given quite a few things to think about and it's clear I'm on the very start of my learning curve.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 45 guests