4 people viewing
Contrary to reports, MTS is NOT compromised, and it IS safe to download from here. For more information, see this thread.
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 17th May 2024 at 12:10 AM
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
3 users say thanks for this. (Who?)
Advertisement
Lab Assistant
#2 Old 17th May 2024 at 11: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 1: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 11: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 2: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 2: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 4: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 11: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 26th May 2024 at 12:54 AM
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 1:08 AM Last edited by ammar2 : 26th May 2024 at 1: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 4: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.
Lab Assistant
#12 Old 17th Jul 2024 at 2:03 PM
Quote: Originally posted by omglo
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.


@omglo did you have successfully managed to create a Sims 2 to Sims 4 rig blender project?

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#13 Old 17th Jul 2024 at 3:40 PM
I have not. I was working on it and hit a glitch and honestly forgot about it after that, since the process no longer works in new blender the way it did in the 2.7 version I used to make the other converters.
Test Subject
#14 Old 14th Aug 2024 at 4:31 PM Last edited by sim2fanyea : 14th Aug 2024 at 4:43 PM.
Hey !
I'm totally new to Unity, and after a while understanding how everything works, I was able to load the project. However, when I hit the play button, this is what I get. If I export the BakedSim as GLB, and import it in Blender, all I get is the skeleton, not even the animation or any mesh.
Did I do something wrong ?
May I also mention that to get to that point, I had to rename all my game files because my localization is FR and my game was called "Les Sims 2". Each time I was hitting "Play", I would get the "object reference not set to an instance of an object". When I renamed to "The Sims 2" it worked. Don't know if my issue has something to do with that... Also, I don't have the Ultimate Collection but the original games. When renaming my folders, I also changed the path to make it as if it was Ultimate Collection.
Screenshots
Mad Poster
#15 Old 16th Aug 2024 at 8:34 PM
I can't help you with Unity, but which version of blender are you using? because from what I can tell, this glb is incompatible with some of the older versions. Which brings up another issue - the newest version of blender that's compatible with Milkshape is 2.8, and the glb won't import into that. Appending the animation into blender over a skeleton compatible with milkshape's animation exporter didn't work either. So if you're creating for Sims 2 just be aware that there might not be a way to get anything into that game right now.
Test Subject
#16 Old 17th Aug 2024 at 10:40 AM
Quote: Originally posted by omglo
I can't help you with Unity, but which version of blender are you using? because from what I can tell, this glb is incompatible with some of the older versions. Which brings up another issue - the newest version of blender that's compatible with Milkshape is 2.8, and the glb won't import into that. Appending the animation into blender over a skeleton compatible with milkshape's animation exporter didn't work either. So if you're creating for Sims 2 just be aware that there might not be a way to get anything into that game right now.


I’m using Blender 4.0. I’m not creating for Sims 2 (not anymore at least for now 😔), I just want to get the animation data with the skeleton in blender and then retarget it to another rigged character of mine. But my glb doesn’t export any animation data, only the skeleton, not even the sim model… So I think something’s wrong in my Unity. Or with the fact that I don’t have Ultimate Collection, I don’t know.
And while we’re at it, I’ve seen we can also have objects animations and I’m really curious about how to get them as well.

Any idea about all that @ammar2 ?
Test Subject
Original Poster
#17 Old 20th Aug 2024 at 9:44 PM
Aah sorry, I don't think you'll be able to run OpenTS2 without the ultimate collection or with the french folder names. We rely on a certain layout of the folders and I'm not sure what it would be for non-ultimate collection sims 2.
Lab Assistant
#18 Old 20th Oct 2024 at 1:16 AM
Quote: Originally posted by omglo
I have not. I was working on it and hit a glitch and honestly forgot about it after that, since the process no longer works in new blender the way it did in the 2.7 version I used to make the other converters.


I don't think it's a problem related to a glitch. I also tried posting a question on the blender support forum , but it seems the issue is related to the empties connected to the rig, which have inverted scales and rotations. This causes inverted results in the 'child of' constraint. I'm trying to follow the suggestions from the forum, but I'm not having much success. Maybe you are more experienced with Blender and can manage? Or could we possibly obtain a rig already exported from Unity without inverted scales and rotations? @anmar2

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#19 Old 26th Oct 2024 at 5:14 PM
Quote: Originally posted by AlexCroft
I don't think it's a problem related to a glitch. I also tried posting a question on the blender support forum , but it seems the issue is related to the empties connected to the rig, which have inverted scales and rotations. This causes inverted results in the 'child of' constraint. I'm trying to follow the suggestions from the forum, but I'm not having much success. Maybe you are more experienced with Blender and can manage? Or could we possibly obtain a rig already exported from Unity without inverted scales and rotations? @anmar2

I'm not sure how much luck I'd have. I used a (now deleted) tutorial from ThePancake1 when making the 3t2 and 4t2 rigs and ran into the rotation problems when I tried to use the same technique to make one for 2t4 conversions, so retargeting rigs isn't really something I'm an expert at.
Back to top