how to make an object bounce slightly when player lands on it.

Hi

Im still making my 3d game/learning environment and within this i have floating rocks that the players have to jump between.

I’ve been trying to make these rocks bounce slightly as the players land on them with no success, Ive tried adding a new physical material(npm to the mesh collider of the rock and changing the npm parameters but made no difference the rock doesnt move at all.

Any help would be wicked

Many Thanks
j

You could do it with Physics, having the rocks float by being held in place by a SpringJoint and applying a force to them in the CharacterControllers’s collision handler - OnControllerColliderHit. Or you could just fake it with an animation.

Check out OnCollisionEnter. I’m assuming your platforms are kinematic rigidbodies, so:

function OnCollisionEnter(other:collider){
    if (other.gameObject.tag == "player")
        //"bounce" by applying some transformation

Alternatively, if you’re doing this using physics, you could attach each of your platforms to an empty, stationary gameobject by a spring joint with suitable damping.