Closed JaXt0r closed 11 months ago
Animations are a tricky one. ;-)
Some links on how to create them at runtime in Unity:
(dead end. No "runtime" animation features):
(Low level. Plugs into Animator. Add animations at runtime.):
Some hints from lmichaelis about how to load the proper animation data from Phoenix: Walk animation load:
Hint: Check checksums for corresponding object (mrm+mdl+...; Should match!).
From OpenGothic (resources.cpp::implLoadMeshMain()
):
humans.mds
)mds.skeleton.disable_mesh
== false
then load mesh with this name== true
then skip this information and load requested object's .mdh (replace .mds with .mdh -> e.g. humans.mdh
)How did Romeyyy import Animations back in the PoC days:
Reverse engineering pro tip:
Animations are imported and working since ~Oct 2023. We now need to optimize them for Unity usage (e.g. collision usage and grounding on the floor).
Goal is to have NPCs behave right: i.e. have idle and walking animations.
Some hints from lmichaelis about how to achieve it with Gothic data:
Animations (and animated models generally) work like this (as far as I can remember at least):
.3DS
-extension of the indicated model with a.MDS
or.MSB
extension (depends on the game: G1 uses.MDS
and G2 uses.MSB
; solve this with a priority lookup. First try.MSB
, then try.MDS
then you can try extensions for non-animated models:.MDL
,.MDH
,.MDM
,.MRM
).MSB
orMDS
) is parsed withphoenix::model_script::parse
model_script::skeleton::name
). This file is looked up with priority like above:.MDL
,.MDH
,.MDM
,.MRM
.MAN
for animations,.WAV
for sound effects and so on)The animations loaded in step 5. will contain a set of skeleton node indices which are animated as well as a set of samples that make up that animation. Each animation has a total of
nodeCount * frameCount
samples, so one sample per frame per node. Each animation also contains the name of the next animation to play, a frame-rate, a layer and a bounding box. I don't know what the bounding box represents though.You can take a look at the Gothic ModKit for additional information: https://github.com/dzieje-khorinis/Gothic-2-Mod-Development-Kit