简体   繁体   中英

Unity: How can I find out what angle I need to shoot from for a physics projectile to land in a certain spot

I need a little help with the math for physics.

Imagine you are shooting bullets from a cannon and depending on angle of the cannon bullet lands at different spots. The force applied to bullet is Unity impulse type.

What would be the best way to calculate what angle I must shoot from to make sure bullet always lands at specific point on the ground?

Vector3 dir = Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.up; _Bullet.AddForce(dir * BulletSpeed, ForceMode.Impulse);

thanks in advance

The equations are

弹道飞行方程

You can also try Projectile Shooter from Wolfram Alpha.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM