Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Technique to apply bouncy breasts and hair physics?

Discussion in 'Editor & General Support' started by Fluffy-Tails, Oct 3, 2010.

Thread Status:
Not open for further replies.
  1. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    So I am creating a game, currently in development for Unity3D using Autodesk 3D Studio Max, and have the main character fully modeled, fully texture mapped but has no textures created yet, is currently being rigged but I have one issue.

    Despite other issues I am having with complex body parts like the shoulders, arms/hands, thighs and knee areas I wish to understand how to go about having the breasts move around and bounce with no preset animation but entirely physics based depending on movement.

    My character has around 3,400-ish polygons for the poly limit and I wish to know how to go about making them movable realistically (to avoid a mature mark) and exaggeratively (primarily targeted towards lesbians and men)
    Would I have to go about making this possible within 3D Studio Max or Unity3D?
    On the other hand, I have bones already setup for the breasts exclusively.

    I am using Max 2010 and the latest Unity3.

    My other question is about hair, how do I make it dynamic and not poke through any polygons or parts of the mesh for the main character?
    My preference is to make no animations but to have the hair use as less resources as possible, any alternatives are okay too.

    Any help please?
     
  2. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    You can control the position of the bones via a script. You need to set the position in the "LateUpdate()" function otherwise it will be overwritten by the regular animation.

    You could store the equilibrium position and basically have the bone on a spring from there or something. You'd probably have to try a bunch of different methods and see what works.

    For the hair I recommend the new skinned cloth feature :)
     
  3. frankrs

    frankrs

    Joined:
    Aug 29, 2009
    Posts:
    300
    If you want to do the animation in max the way to go is to use a spring contoler for each boob and link each one to your chest/ torso bone
     
  4. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    659
    Surely that wouldn't export to Unity ?
     
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    The bones behave as child objects, so you could try adding a character joint and a rigidbody to each breast. The character joint has the option of returning to the default position using a sprint, which should give the desired bounce.
     
  6. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    This is the most intelligent conversation about breasts I have ever seen on the internet.
     
  7. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    Thank you, I will give that a try once I get it into Unity when I feel it is right.

    Other than that, is there anything else I should worry about as well?
    My character wears a shirt as well and I want it to follow the base mesh and I am not sure if Max 2011 can export a skin wrap into Unity3?
     
  8. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Amen.
     
    Westland likes this.
  9. Fluffy-Tails

    Fluffy-Tails

    Joined:
    Jun 28, 2009
    Posts:
    120
    I'm a pervert like anyone else, I may prefer woman who gives a damn? X3

    I know it seems angry but I think everyone's a pervert and I don't believe in censorship.
    I'm also not traditional, I like to do what's on my mind.

    Anyway, who doesn't want to break tradition and be original? XD

    Also, I think angry mommy organizations prevent most people from doing what they want... I care less for the kids and just want my ideas out there regardless of "feelings" or "censorship."
     
    Nanako likes this.
  10. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    I know this thread is a bit old, but I thought I would share my solution.

    I am using a modified version of Pegorari's Rubber Simulation Script (http://forum.unity3d.com/threads/45148-Rubber-Simulation-Script?highlight=rubber+duck) in order to calculate the Mass, Stiffness, Damping, Acceleration and Force. Instead of modifying verticies, I modify the rotaiton of skinned bones instead (much, much faster).

    I still need to put in a limiter on the joint rotation because if you whip it around fast enough the bones will rotate all the way around. You can notice this the most on the X Rotation slider. Once that is done I'll post it in the wiki.


    Webplayer:
    http://www.mikecookportfolio.com/jiggleBone/jiggleBoneWeb.html
     
    Last edited: Sep 26, 2011
    Westland likes this.
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Best thing I've seen in unity, ever.
     
  12. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Ok it appears that I have fixed (minimized) the rotating joint weirdness. I also added a "squash and stretch" aspect to it now. I am surprised how much of a difference it makes. Much more fluid and natural motion. You can notice it if you rotate the model so it would be laying on its stomech and then translate it up and down. Theres a secondary jiggle now.

    I just overwrote the file so the link in the first post should point to the new webplayer. Might need to clear the cache in order to load the newest one.

    God, I feel like the worlds biggest perv . . . oh well! :D Hopefully someone will find this usefull. Now time to write up a wiki page . . .
     
    Westland and RaoulWB like this.
  13. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    if you spin too much they flatten out and become offensive frisbees.
     
  14. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Hahaha offensive frisbees! lol. Hmmm maybe i should set a min scale and maxiumum scale, so they wont flatten out or turn into torpedoes.
     
  15. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    I tweaked the side scaling down a bit and left the forward scaling the same. I guess its just a matter of tweaking it how ever you want it to behave.
     
  16. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Westland likes this.
  17. sooshicat

    sooshicat

    Joined:
    Aug 4, 2012
    Posts:
    11
    I know this thread is pretty old, but how would that rubber script work on hair do you think?
     
  18. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Should work fine, as long as there are bones in the hair to move.
     
  19. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    326
    Nice! This is much better than trying to use SkinnedCloth on a high-poly character!

    EDIT: It just wasn't working for my use case no matter what I did. I think the 90 degree rotation of Blender imports had something to do with it. Anyway, I went back to the drawing board and came up with my own version.

    My version doesn't do squash stretch, gravity, or damping, but it's super lightweight and it works great on hair and clothing. Just slap the script on literally any Transform and fiddle with the exposed values. Chains of bones each with a script on 'em are no problem.

    It works using World coordinates, so I'm pretty sure it's impossible to mess up, but let me know if you encounter any problems. If nobody finds anything wrong with it, I'll throw it on the wiki.

    Happy bouncing!

    EDIT: Fixed strange behavior when moving or rotating long distances during one frame.

    Code (csharp):
    1.  
    2. //
    3. // Jiggle Bone (Simple version)
    4. //   -  by WarpZone
    5. //
    6. //  TO USE:
    7. //  Simply attach this script to any Transform in your model's hierarchy.
    8. //
    9. //  FEATURES:
    10. //    -  It doesn't matter what the forward normal of your bone is, it just works.
    11. //    -  Bounce and sway can be configured independently
    12. //    -  Simple script is Simple.
    13. //
    14. // If you want to call the bounce code using some sort of manager script, comment out the JiggleBonesUpdate call and SendMessage JiggleBonesUpdate from your Manager instead.  
    15. // This is useful if you want to control which bones update first, or strategically layer other procedural animation effects at runtime.
    16. //
    17.  
    18. #pragma strict
    19.  
    20. var bounceFactor: float = 20;
    21. var wobbleFactor: float = 10;
    22.  
    23. var maxTranslation: float = 0.05;
    24. var maxRotationDegrees: float = 5;
    25.  
    26. private var oldBoneWorldPosition: Vector3;
    27. private var oldBoneWorldRotation: Quaternion;
    28.  
    29. private var animatedBoneWorldPosition: Vector3;
    30. private var animatedBoneWorldRotation: Quaternion;
    31.  
    32. private var goalRotation: Quaternion;
    33. private var goalPosition: Vector3;
    34.  
    35. function Awake(){
    36.     oldBoneWorldPosition = transform.position;
    37.     oldBoneWorldRotation = transform.rotation;
    38. }
    39.  
    40. function LateUpdate () {
    41.     JiggleBonesUpdate();
    42. }
    43.  
    44. function JiggleBonesUpdate(){
    45.     //Mesh has just been animated
    46.     animatedBoneWorldPosition = transform.position;
    47.     animatedBoneWorldRotation = transform.rotation;
    48.     goalPosition = Vector3.Slerp(oldBoneWorldPosition, transform.position, Time.deltaTime * bounceFactor);
    49.     goalRotation = Quaternion.Slerp(oldBoneWorldRotation, transform.rotation, Time.deltaTime * wobbleFactor);
    50.    
    51.     transform.rotation = Quaternion.RotateTowards( animatedBoneWorldRotation, goalRotation , maxRotationDegrees );
    52.     transform.position = Vector3.MoveTowards( animatedBoneWorldPosition, goalPosition , maxTranslation );
    53.        
    54.     oldBoneWorldPosition = transform.position;
    55.     oldBoneWorldRotation = transform.rotation;
    56. }
    57.  
     
    Last edited: Jan 8, 2013
    Westland and BurzumStride like this.
  20. sooshicat

    sooshicat

    Joined:
    Aug 4, 2012
    Posts:
    11
    @WarpZone
    Bless you for that simplified script!! Thanks!
     
  21. twigs192

    twigs192

    Joined:
    Jan 4, 2013
    Posts:
    18
    For hair I'd recommend the Shroud plugin by cloakworks. (shot with my crappy iPhone) [video=youtube_share;UFhESdjgYcI]http://youtu.be/UFhESdjgYcI
     
  22. frankrs

    frankrs

    Joined:
    Aug 29, 2009
    Posts:
    300
    I don't know about that. I was excited when I saw the ad for Shroud but on closer inspection I think it's only baked vertex animation (though I could be wrong), so if you were to go that route theres several vertex animation import plugins to use that are loads cheaper.
     
  23. rmele09

    rmele09

    Joined:
    Nov 8, 2010
    Posts:
    712
    Dude those boobs are awesome haha. All jokes put aside, they jiggle realistic and I like how you did it.
     
  24. DaveA

    DaveA

    Joined:
    Apr 15, 2009
    Posts:
    310
    I managed to get the same results, maybe better? just using spring joints. I attach a 'bra' for each breast as a child of the chest joint, offset it each above and in front, roughly, of each breast bone, then attach spring, rigid body, and set mass and dampening etc.. No script, pure physics. Pure enjoyment.
     
    theANMATOR2b likes this.
  25. k0psutin

    k0psutin

    Joined:
    Oct 6, 2018
    Posts:
    1

    Here's bouncy physic updated in C#, thanks for the amazing script!

    Code (CSharp):
    1.  
    2. //
    3. // Jiggle Bone (Simple version)
    4. //   -  by WarpZone
    5. //
    6. //  TO USE:
    7. //  Simply attach this script to any Transform in your model's hierarchy.
    8. //
    9. //  FEATURES:
    10. //    -  It doesn't matter what the forward normal of your bone is, it just works.
    11. //    -  Bounce and sway can be configured independently
    12. //    -  Simple script is Simple.
    13. //
    14. // If you want to call the bounce code using some sort of manager script, comment out the JiggleBonesUpdate call and SendMessage JiggleBonesUpdate from your Manager instead.
    15. // This is useful if you want to control which bones update first, or strategically layer other procedural animation effects at runtime.
    16. //
    17.  
    18. using UnityEngine;
    19.  
    20. public class jiggleBone2 : MonoBehaviour {
    21.  
    22.     public float bounceFactor = 20;
    23.     public float wobbleFactor = 10;
    24.  
    25.     public float maxTranslation = 0.05f;
    26.     public float maxRotationDegrees = 5;
    27.  
    28.     private Vector3 oldBoneWorldPosition;
    29.     private Quaternion oldBoneWorldRotation;
    30.     private Vector3 animatedBoneWorldPosition;
    31.     private Quaternion animatedBoneWorldRotation;
    32.     private Quaternion goalRotation;
    33.     private Vector3 goalPosition;
    34.  
    35. void Awake()
    36.     {
    37.         oldBoneWorldPosition = transform.position;
    38.         oldBoneWorldRotation = transform.rotation;
    39.     }
    40.  
    41.     void LateUpdate()
    42.     {
    43.         JiggleBonesUpdate();
    44.     }
    45.  
    46.     void JiggleBonesUpdate()
    47.     {
    48.         //Mesh has just been animated
    49.         animatedBoneWorldPosition = transform.position;
    50.         animatedBoneWorldRotation = transform.rotation;
    51.         goalPosition = Vector3.Slerp(oldBoneWorldPosition, transform.position, Time.deltaTime * bounceFactor);
    52.         goalRotation = Quaternion.Slerp(oldBoneWorldRotation, transform.rotation, Time.deltaTime * wobbleFactor);
    53.  
    54.         transform.rotation = Quaternion.RotateTowards(animatedBoneWorldRotation, goalRotation, maxRotationDegrees);
    55.         transform.position = Vector3.MoveTowards(animatedBoneWorldPosition, goalPosition, maxTranslation);
    56.  
    57.         oldBoneWorldPosition = transform.position;
    58.         oldBoneWorldRotation = transform.rotation;
    59.     }
    60.  
    61. }
     
    vinnieecho, pry_bar and Ramsphere like this.
Thread Status:
Not open for further replies.