简体   繁体   English

团结:如何找出要从哪个角度射击物理弹头才能降落在某个位置

[英]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. 施加在子弹上的力是Unity脉冲类型。

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. 您也可以尝试Wolfram Alpha的Projectile Shooter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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