射箭游戏编程算法 [英] Archery game programming algorithm

查看:690
本文介绍了射箭游戏编程算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要的算法动画基于2个参数,角度同时拍摄和功耗,同时绘制弓的箭。 香港专业教育学院试图用Y = asinx但在拍摄了方向的时候才起作用。不工作时也直或向下的方向拍摄。谢谢你。

I need the algorithm to animate the arrow based on 2 parameters, angle while shooting and power while drawing the bow. Ive tried to use y=asinx but it works only when shooting in up direction. Doesnt work well while shooting with straight or down direction. Thanks.

推荐答案

您弹丸的飞行中

x(t) = v * cos(theta) * t
y(t) = v * sin(theta) * t - 1/2 * g * t^2

其中t是时间,V初始速度(功率),θ-角度,克重力加速度(例如9.8米/秒2)中,x的水平坐标和y的高度。​​

where t is time, v the initial velocity (power), theta the angle, g the acceleration due to gravity (e.g. 9.8 m/s^2), x the horizontal coordinate and y the height.

这篇关于射箭游戏编程算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆