Physics material simulation

Hey Justin,
Ive tried to use physics materials but they don't seem to work, can i use them with the controller?
if not how would i go about implementing it,

A perfect example would be a bouncy box where the character will bounce on it or an icy plane

Regards Josh
 
I think that your best bet is to create an ability that specifically reacts to the different types of surfaces that you are creating. This will give you the most flexibility and you can design it exactly as your design documentation specifies.
 
This is mostly a new feature - there is some code to get the material within MathUtility.FrictionValue/BouncinessValue but this is used in a specific case for horizontal collision detection.
 
I tried to use Physics material on a character but no success. The idea is to have the character to bounce after being knockdown on the ground.

How can i achieve this?

Thank you!
 
What are your phyics material's settings? Make sure to set the bounciness mode to "maximum" if you don't have it applied to the character AND the surface.

Also for landing-specific stuff, you may want to instead listen for the "OnCharacterLand" event (which passes a float parameter which is the distance the character fell from) and use that to create a bounce effect.
 
I created a basic cube object for testing purpose and the objects bounces as expected.


Screenshot 2021-04-06 081856.png


Screenshot 2021-04-06 081809.png


I tried to add Physics material to character's capsule collider or other collider had no effect in the character.

Screenshot 2021-04-06 081736.png


Thank you!
 
Ah well if it's for the character itself, then physics materials may not affect all of its collisions and movement since it only uses a kinematic rigidbody and handles most of the forces and collisions logic itself. I think a bouncy material will still cause you to bounce off walls if you run into them, but for bouncing off the ground, you'll need to do this with a custom script, e.g. using the "OnCharacterLand" event as I suggested above. You could then use CharacterLocomotion.AddForce to add an upwards force on the character.
 
Top