Home Creators Posts Import Register Favorites Logout

Content

Ok, I decided to make this into a post because I spent upwards of 8 hours trying to solve this bug and you guys might get a laugh out of it.

THE BUG

Whenever the game is left idling, characters that have a mix of animations and physics tend to slowly break apart.

This problem was happening in both Project Cappuccino 2 and Milking Mira so this means I've essentially fixed both in one go. The Milking Mira project forced me to tackle it since it's closer to shipping.Here the game was left running for about 30 minutes and her head started floating off and boobs started falling off of her chest. The cuffs aren't aligned either.

Removing the object and re-instantiating it into the game scene fixes it but I can't be doing that all the time, especially not with Mira's Milkers. I noticed this bug back in early capp 2 development but it wasn't that big of an issue in that game yet since its mostly noticable on long haired dialogue portraits or things with chain links. Since the portraits would pop on screen and very few people would keep them static for like 30+ minutes, it didn't matter much to me yet. 

I eventually tracked it down to some sort of floating point leak in the object positions but I couldn't figure out why it was happening. I messed with almost every physics and animator setting in the engine and nothing worked. The position gradually changes forever until the object is destroyed. It's such an obscure bug that only seems to be happening to my particular way of mixing animations and physics because all of the advice on forums wasn't leading me anywhere.

Time to bust out the graphs.

Detail of the Components - Pardon My Shitty Art

 This is the best way I can describe the parts

• Green is a bone controlled by animation and moves the character parts.

• Red is any object nested within that bone that moves along with the bone, but doesn't have any animations itself. The base of the head in Mira's case.

• Blue are bones with hinge joints attached and used to simulate physics sway. They aren't animated and just dangle there. (Boobs, Hair, Accessories)

The leak seems to come from the engine trying to update the red objects position through the green bone's animation, while the blue bone is weighing it down with physics. Locking the red object or setting all gravity, drag, etc on the physics stuff to 0 wasn't changing anything for some reason. Just the fact that a joint exists and an animation exists is enough for this bug to happen.

How I fixed it!

• Get the position of an object at the beginning of a frame before the animation step is processed.

• Let the animation play and change object positions.

• Set the position of the object to what it was at the beginning of the frame after everything else has been calculated. (Animation, Physics.)

It's basically autocorrect for object positions and cancels out that little leak. I only hope it doesn't cause any major performance issues but so far so good.

Thanks for reading and I'm sighing a breath of relief! This fix will most likely be included in the next update to PC2.

BONUS

I followed advice online telling me to change every physics setting under the sun and this happened.

 

I decided not to implement the tornado tits mechanic.

-Vanis

Files

Comments

EarlGrayAddict

Mira! I choose you! Use Tornado tits!!!

Toastywafflz

This is hilarious and one of the things I love about game dev is the bizarre spaghetti nonsense you encounter along the way. Thanks for sharing hahah, I love it. I also will take any chance I get to gaze upon Mira so that's a fun bonus.