python-3.x - Python 3.9.0 - 阻力工作异常的物理模拟
问题描述
def CalculateAcceleration(self):
currentTheta = math.atan(self.velocity[1]/self.velocity[0])
currentSquaredVelocity = math.pow(self.velocity[0],2)+math.pow(self.velocity[1],2)
accelerationMagnitude = currentSquaredVelocity*self.coeffD
self.acceleration = [math.cos(currentTheta)*accelerationMagnitude, math.sin(currentTheta)*accelerationMagnitude]
self.acceleration = [self.acceleration[0], self.acceleration[1]-self.g]
我相信这就是问题所在,并且仅在弹丸向右移动时才会发生。
解决方案
我忘记了力计算中的负号
推荐阅读
- python - Python如何替换文本文件中特定行中的特定单词?
- ruby-on-rails - ruby中使用from_xml函数有什么优缺点
- sql - PostGIS st_point 函数为所有不符合条件的记录返回空值
- vhdl - “=”函数适用于所有类型,我可以从哪里显式获取它?
- javascript - 无法使用实习生和前脚 API 在网页上定位元素并出现错误
- php - 使用特定 PHP 版本部署到 AppEngine (Flex) 时出现问题
- java - Double Check Lock 不能在这个 java 代码上工作?
- java - 为什么 Firebase 数据库 getUid 不起作用?
- css - 是否可以使用 css 创建材质 ui 主题?
- kotlin - kapt 的 aptMode 是做什么用的?