- Home /
How to make fire shot like Super Mario 3D World?
Hi! I have been trying to make bouncing shot like Super Mario 3D World. So the shots height from ground should be the same all time regardless of height it was released. And vertical speed shouldn't affect bounce neither. Should it be animation or just all by code? I've been struggling with this for many days now.
Here is a video of the shot in SM3DW https://www.youtube.com/watch?v=6YtAmkTKA1I&feature=youtu.be
Depends on wether you want to use Unity's Physics engine or not. If yes, then you'll have to calculate/eyeball the neccessary force and torque to make the ball jump. If not, then you'll have to directly move the projectile, for example via Transform.Translate. Use an online mathematical function plotter to find the correct mathematical functional neccessary.
Should i zero all forces and angle when shot hits the collider and the give it new force and angle? It looks like shot in S$$anonymous$$3DW moves unnaturally fast. If i put same velocity to my shot it bounces way too high.
Answer by Paricus · Dec 05, 2016 at 02:14 PM
you could try instantiating the object, and add a force in the forward direction (relative to the player), add a bounce physics material to the objects collider, you can edit bounce properties by directly selecting the physics material.
The object shouldn't take the vertical velocity of the player because its being instantiated separate from the player, the only influence will be gravity, which is what you want for the bounce.
I did this. Bounce height won't be the same always. If i'm higher from "ground" it bounces higher...
I'm not sure if this would work, but you could try clamping the velocity of the ball when it hits the floor.
rigidbody.velocity = (rigidbody.velocity.normalised * bounciness)
this should keep the reflection of the bounce but you get to control the velocity at which the ball hits the ground and so each bounce will be the same height. you could either add this to OnTriggerEnter or OnCollisionEnter. you might want to make a trigger thats slightly larger than the actual mesh so it has time to change the velocity before collision.
again not sure if this will work but its worth a shot
Your answer
Follow this Question
Related Questions
rigidbody, kinematic beginner woe 3 Answers
touch screen position rotate turret and shot same time 0 Answers
How do I add sound to this script 1 Answer
Random Gun Jam with Array 1 Answer
Object name not found? 1 Answer