- Home /
Why do I get different rigidbody.velocity depending on angle?
I got bullets that are handles with physics by applying force to it. I just noticed that the impact speed is much higher in steeper angles when hitting a collider. I use this muzzleDirection that is gameobject.transform.forward that will represent the muzzle on the rifle.
_rigidbody.AddForce(this.muzzleDirection * power, ForceMode.Impulse);
I am using rigidbody.velocity.magnitude to get the speed. But as shown in the image (that I could not upload), when hitting something the speed is around 90 m/s when straight ahead and 400+ m/s in steep angles. It should always be around 400 m/s. Any clues?
I have tried that but still getting the same result.
Answer by Bunny83 · Jun 22, 2019 at 01:41 AM
What physicsmaterial does the two objects use? What's the bounciness and bounce combine setting of those two materials? A bounciness of 0 will result in an inelastic collision. So all energy along the surface normal will be "absorbed". A bounciness value of 1 will result in a full elastic collision so all energy is reflected.
Though the physics materials are meant to control the collision response. If you just want to know the relative impact velocity you should just use the relativeVelocity of the Collision class
This fixed that problem! Thanks! I think used relativeVelocity before, but I remember why I started to use the rigidbody.velocity ins$$anonymous$$d. Thats bacause the relativeVelocity of the Collision class return 0 if the distance is less the around x units. I have tried to wait for the physics to update the relativeVelocity but that gives me the same result as using rigidbody.velocity. Lower straight ahead and higher depending on angle.
Your answer
![](https://koobas.hobune.stream/wayback/20220612203632im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can i initiate an object in parabolic motion without using gravity using Rigidbody2D? 0 Answers
Adapting Velocity-based Platformer Controls to Camera Forward 0 Answers
how to have a fixed movement using rigidbodies without animations 0 Answers
Rigidbody2D adding force vs modifying velocity for character jump 1 Answer