Rigidbody Mass Question

jasontuttle

New member
I have some crates in my scene which have Rigidbodies attached to them with default settings. When my character collides with them, they move way too easily. If I increase the Mass of the crate's Rigidbody, it has no effect. They do not appear to get any "heavier". If I decrease the Mass of the character in the Physics section of the Ultimate Character Locomotion component, it has no effect either.

I've also tried creating a fresh new scene, adding a simple plane and a cube. I then added a Rigidbody to the cube. I then created a fresh new UCC character with default settings. Same problem. Mass seems to have no effect on either the cube or the character.

Is this a bug? If not, how do I make objects "heavy" so that when the character collides with them, they do not move easily?

Thanks in advance for your help!

: )

J
 
The controller pushes the rigidbody with:

Code:
targetRigidbody.AddForceAtPosition((moveDirection / Time.fixedDeltaTime) * (m_Mass / targetRigidbody.mass) * 0.01f, point, ForceMode.VelocityChange);

So the larget the target rigibodys mass is the less the object should move. If you place a breakpoint on this like within CharacterLocomotion do the values look correct?
 
So after doing some more research, it seems as though, if a UCC character collides with an object that is not on the "Default" layer, Mass stops working. As a test, I did the following:

  1. Created a fresh new project in Unity 2018.2.11f1
  2. Imported nothing other than the UCC version of the Third Person Character controller
  3. Set my build target to iOS (because that's my project's build target)
  4. Created an "Environment" Layer
  5. Created a new scene with a plane and a cube
  6. Set the plane to static
  7. Added a Rigidbody to the cube
  8. Assigned both the plane and the cube to the Environment layer
  9. Added the Nolan model to the scene
  10. Set up Nolan as a UCC Third Person Controller character with default settings
  11. Added Environment to Solid Object Layers in Nolan's Layer Manager component.
  12. Set the Mass of the cube to 100 to match Nolan's default Mass of 100
  13. Play
  14. The cube bounces around like it's got no Mass
  15. Switch the cube to the Default layer
  16. Play
  17. The cube doesn't move at all when Nolan pushes against it
Is there some other component that needs to be updated in order for layers other than Default to work with Mass?

Also worth mentioning, I took a look at the Collider Layer Mask in the Physics section of Nolan's Ultimate Character Locomotion component. My Environment layer is checked. -- I assume adding it the the Solid Objects Layer added it to the Collider Layer Mask automatically?

Thanks for all your help on this!

: )

J
 
I just tried to reproduce this but when I set a mass of 100 on the cube it didn't move much in comparison to when it is 1 on the Environment layer. Are you running the latest version of UCC?
 
I just tried to reproduce this but when I set a mass of 100 on the cube it didn't move much in comparison to when it is 1 on the Environment layer. Are you running the latest version of UCC?

Yes -- I'm on the latest version of UCC. The only other thing I can think of that's different about my project is that I switched to .NET 4.x, but I don't see how that could be causing this problem.

Yesterday, I decided to delete my Environment layer and set up all of my layers the way UCC expects them. Then, I rebuilt my test character and put all of my environment elements on the Default layer. Now Mass works correctly in my project. In the end, that just seemed like the path of least resistance to solving my problem.

Thanks again for all your help on this!!!

: )

J
 
Can you insert a breakpoint within CharacterLocomotion and determine if the magnitude is the same within
targetRigidbody.AddForceAtPosition?
 
Can you insert a breakpoint within CharacterLocomotion and determine if the magnitude is the same within
targetRigidbody.AddForceAtPosition?

OpenedWithImage (4).png

I set the breakpoint you requested, and as far as I can tell, everything looks correct, but the problem persists. Objects on the Environment layer, bounce around like they have little or no Mass. If I put those same objects on the Default layer, Mass works properly.
 
That looks like it's some type of a physics setting issue. I don't think anything within UCC would cause this behavior if the correct force is being applied.
 
That looks like it's some type of a physics setting issue. I don't think anything within UCC would cause this behavior if the correct force is being applied.

Agreed, but this test was run on a fresh new project, all on default settings, Physics included. Nothing but the UCC asset imported.

Anyway, for now, I'm good to go. -- Yesterday, I decided to delete my Environment layer and set up all of my layers the way UCC expects them. Then, I rebuilt my test character and put all of my environment elements on the Default layer. Now Mass works correctly in my project. In the end, that just seemed like the path of least resistance to solving my problem.

Thanks again!!

: )

J
 
Top