Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 16th May 2024 at 11:10 PM
Default Sims 2 Animations exported with baked inverse kinematics
Hey all, if you've ever tried to export animations from sims 2, you'll know that they do this weird thing where they don't quite look right. This is because the animations use inverse-kinematics, the animators say where the hands/feet/head/etc should go and then the 3d animation program figures out how to move the limbs to make it happen.



In most games these inverse kinematics get "baked" into the animation files so the movement of each individual bone and limb is recorded. But unlike most games, Sims 2 uses these inverse kinematics in the final animations shipped with the game and the game engine runs the inverse kinematics as you play.


With that background out of the way, I was looking at reverse-engineering the animation format for OpenTS2 and figured out how these inverse-kinematics are set up. I haven't documented my findings but you can find some more information on the cAnimResourceConst scenegraph blocks here. With the inverse-kinematics part of the animations decoded, we are now able to play some animations from the game successfully! (Note that some animations where the hands should be pinned to objects etc still don't work well)



Since this is all done in Unity, we can actually export these animations to a format that can be imported into blender. There isn't currently a way to directly export from blender back to a sims 2 animation file without milkshape (I might make a plugin for that if I'm feeling bored). But you try to customize these animations or try to port them to future games. I have exported 10 base game animations to a .glb file available here: https://blog.ammaraskar.com/assets/...es/bakedSim.glb

If you're just curious, there is also an online model viewer available here where you can view them straight from your web browser.


What's cool is this web editor can also display other game assets, such as the reclining chair here.



Unfortunately the process to export animations fully-baked yourself will be a bit involved and need some know-how on Unity but hopefully some of you can get through it and help others out.

1. Grab and setup the OpenTS2 bake_ik_animations branch code from here https://github.com/LazyDuchess/Open...ile#development
2. Open the SimAnimationTest scene and type in the name of the animation you want

3. Right click the bakedSim and select UnityGTLF and then Export Selected as GLB


Thank you to @AlexCroft for bringing this up on the OpenTS2 repo here! https://github.com/LazyDuchess/OpenTS2/issues/59
2 users say thanks for this. (Who?)
Advertisement
Lab Assistant
#2 Old 17th May 2024 at 10:11 PM
Thanks to @anmar2 's work we can now finally export ts2 animations to blender (using unity) ! I'm trying now to retarget the animation to a sims 4 rig in order to export animations in the sims 4 (like the car get in animation). But it's a difficult process. Maybe @omglo can help us in this project reversing the current 4to2 animation retargeting (https://modthesims.info/showthread.php?t=637212.

Screenshots

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#3 Old 18th May 2024 at 12:48 AM
This is really great, guys.

I'd be willing to look into making a 2to4 rig when I have time.
Test Subject
#4 Old 19th May 2024 at 10:09 PM
woah this is incredible!! hopefully this is a big step forward to make a proper way to create animations for TS2 in Blender ♥ (wich I have been looking for years lol :_____) )
Mad Poster
#5 Old 21st May 2024 at 1:13 PM
@alexcroft - do you have a Sims 2 rig with the IK bones to work with, or are you usuing the old GMDC without those included?
Lab Assistant
#6 Old 21st May 2024 at 1:59 PM
The unity anmar2 script bakes the ik chain directly on the rig.
So the animation keys in the resulting exported rig are not on the ik bones.
Although you can export also the whole rig animation with the animation of the ik chain, you have to simply export the fbx using the unbaked animation.
I’ve tryed to reconnect the IK bones chain to the corresponding rig bones in blender, but it was difficult to me, so I prefer to use the ik baked version.

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#7 Old 25th May 2024 at 3:23 PM
So, does anyone know what I'm doing wrong here? I filled out the config.json like this below and left it in the OpenTS2-bake_ik_animations folder. I installed the correct unity and VS.

"C:/Program Files/The Sims 2 Ultimate Collection",
"user_dir" : "C:/Users/myname/Documents/EA Games/The Sims™ 2 Ultimate Collection",
Screenshots
Lab Assistant
#8 Old 25th May 2024 at 10:30 PM
You have to press the play button in order to launch the script

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#9 Old 25th May 2024 at 11:54 PM
Thanks, such a simple thing I missed. But I must've still done something wrong, because playing it says "object reference not set to an instance of an object" when I press play, and I don't get the baked Sim etc in the hierarchy like ammar2 has in their screenshot.
Test Subject
Original Poster
#10 Old 26th May 2024 at 12:08 AM Last edited by ammar2 : 26th May 2024 at 12:24 AM.
Make sure that in your config.json, the "dlc" array has the first element (the base game folder) set correctly. For example mine looks like this:

Code:
{
	"game_dir" : "C:/Program Files (x86)/EA Games/The Sims 2 Ultimate Collection",
	"user_dir" : "C:/Users/Ammar/Documents/EA Games/The Sims 2",
	"dlc" : [
		"The Sims 2",
                ...
         ]
}
Mad Poster
#11 Old 28th May 2024 at 3:15 PM
Thanks, I have it working and have been trying it out over the last couple days. Now I just have to see how these look after being filtered through milkshape.
Test Subject
#12 Old 6th Jun 2024 at 7:05 AM
Thanks for helping me out, I am also trying to export animations from sims 2 and I was confused before but you made my day.
Back to top