|
Hello, I am a member of a team working on a 2.5D plarformer. We got most of our mechanics working, but for some reason we are completely unable to add a "rebound" effect when the Player Character jump on an ennemy. Since a Character Controller can't be affected by physics, using the "bouncy" material is out of the question. How would you script a "rebound" effect for the Character Controller? We are really new to scripting and game creation, so sorry if the answer is obvious.
(comments are locked)
|
|
Along the same lines as Will's suggestion, you could try just inverting the Y-axis velocity, or explicitly set it to a value. The scripting reference for RigidBody.Velocity suggests:
However, that may not be an issue for you here (depending on style of game, and the gameplay outcomes, etc) If you want to rebound based on how fast you are falling, you could try something like:
This would mean that if the player character was moving (down) on the y axis at 10 m/s, they would be instantly set to bounce up at 8 m/s. If you wanted reliable bounces, you could explicitly set it to a value. ** This may not be the best way, but I don't think using the relativeVelocity is ideal for typical 2.5D platformer behaviour.
(comments are locked)
|
|
Well I am new too, but have you tried finding the velocity of the player and then on collision reversing it into a negative?
(comments are locked)
|
