在我们的抛射运动中实现风速?
我正在尝试用 java 制作一款类似于《焦土》或《袖珍坦克》的坦克游戏,用户可以定义射弹的角度和速度。我在互联网上寻找一种将风速应用到我们的射弹系统中的方法。如何将风速添加到抛射运动中?
我的程序计算速度的 X 加速度和 Y 加速度,并考虑达到的最大高度、到达终点所需的总时间以及发射的射弹的角度。
I'm attempting to make a tank game in java in the vein of Scorched earth or Pocket Tanks, in that the user defines the angle and velocity of the projectile. I have looked over the internet for a way to implement wind speed into our projectile system. How do you add wind speed to projectile motion?
My program calculates X-Acceleration and Y-Acceleration of velocity, as well as taking to account the maximum height reached, the total time it takes to reach the final point, and the angle of the projectile launched.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试使用拖动力 = A * |Δv| * Δv *(表面积)+ B * Δv * 表面积,其中 Δv =(风速)-(弹丸速度),并将其添加到模拟中的其他力中。 (然后使用牛顿定律(ΣF = ma)计算加速度)
请注意,表面积是暴露在风中的有效面积。例如,如果您的射弹是圆盘形的,那么如果风吹向圆盘的表面,则会产生非常高的阻力,而如果风吹过圆盘,则会产生很小的阻力。
另请注意,这不包括拖曳扭矩(施加在射弹不同点上的力,导致非零净扭矩,从而导致射弹角动量的变化),例如风车或下落的枫树种子。这可能比阻力建模要困难得多。
Try using a drag force = A * |Δv| * Δv * (surface area) + B * Δv * surface area, where Δv = (wind velocity) - (projectile velocity), and add it to the other forces in your simulation. (and then use Newton's law (ΣF = ma) to compute acceleration)
Note that the surface area is an effective area exposed to the wind. If your projectile is disc-shaped, for instance, there will be a very high drag force if the wind is blowing at the face of the disc, whereas there will be a low drag force if the wind is blowing across the disc.
Note also that this does not include drag torque (forces applied at different points of the projectile causing a nonzero net torque, and hence a change in the projectile's angular momentum) e.g. on a windmill or a falling maple seed. That's probably a lot more difficult to model than drag force.
为了简单起见,如何根据风来的方向与弹丸行进的方向相比较来增加或减少水平速度。
如果是顺风,它会随着时间的推移增加一定量的速度,直到达到顺风对弹丸本身贡献的最大速度,对于逆风几乎也是如此,除了在与某些特定角度弹丸的水平速度 足够高的逆风可能会逆转水平速度。
射弹在空中停留的时间越长,风发挥其魔力的时间就越长。
To keep it simple How about adding or subtracting horizontal velocity based on the direction the wind is coming from compared to the direction the projectile is traveling.
if it is a tail wind it will add a certain ammount of velocity over time until it reaches the max velocity that the tail wind can contribute to the projectile itself, and the same is almost true for head wind except that at a certain angles with certian horizontal speeds of projectile a head wind of high enough speed may reverse the horizontal velocity.
the longer the projectile is in the air the more time the wind has to work its magic.
或者,您可以不使用阻力,而只实施常规力。如果您的物体都具有相同的尺寸和形状(横截面形状),则只需选择 F 并将该力应用于速度计算。
Or instead of using a drag force, you can just implement a regular force. If your objects are all the same size and shape (cross secitonal shape), just pick an F and apply that force to your velocity calculations.