1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. Unity 2017.1 beta is now available for download.
    Dismiss Notice
  5. Unity 5.6 is now released.
    Dismiss Notice
  6. Get further faster with the Unity Plus Accelerator Pack, free for new Unity Plus subscribers for a limited time. Click here for more details.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  8. Learn how you'll soon be able to publish your games to China in four simple steps with Xiaomi. Sign up now for early access.
    Dismiss Notice

Technique to apply bouncy breasts and hair physics?

Discussion in 'Editor & General Support' started by Janet-Merai, Oct 3, 2010.

  1. Janet-Merai

    Janet-Merai

    Joined:
    Jun 28, 2009
    Posts:
    88
    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:
    626
    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:
    295
    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:
    626
    Surely that wouldn't export to Unity ?
     
  5. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,769
    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. Janet-Merai

    Janet-Merai

    Joined:
    Jun 28, 2009
    Posts:
    88
    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 Moderator

    Joined:
    Apr 11, 2010
    Posts:
    18,834
    Amen.
     
  9. Janet-Merai

    Janet-Merai

    Joined:
    Jun 28, 2009
    Posts:
    88
    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:
    442
    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.

    [​IMG]
    Webplayer:
    http://www.mikecookportfolio.com/jiggleBone/jiggleBoneWeb.html
     
    Last edited: Sep 26, 2011
  11. hippocoder

    hippocoder

    Digital Ape Moderator

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

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    442
    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 . . .
     
  13. hippocoder

    hippocoder

    Digital Ape Moderator

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

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    442
    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:
    442
    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:
    442
  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:
    442
    Should work fine, as long as there are bones in the hair to move.
     
  19. WarpZone

    WarpZone

    Joined:
    Oct 29, 2007
    Posts:
    211
    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
  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:
    295
    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:
    607
    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:
    280
    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.