我的对象当前仅使用以下代码以设定角度沿直线移动:
this.time = this.time + deltaTime;
// Vertical : Speed * Sine * Angle
double vy = (this.speed * Math.sin(this.angle)) + this.ax*this.time ;
// Horizontal : Speed * Cosine * Angle
double vx = (this.speed * Math.cos(this.angle)) + this.ay*this.time;
this.x = this.x + vx*this.time;
this.y = this.y + vy*this.time + this.ay*(this.time*this.time);
vx += this.ax * this.time;
vy += this.ay * this.time;
我假设我在计算方面犯了某种数学错误,因为看起来x值是正确的,尽管y值没有下降。
如果您想知道,这是我的初始值:
this.time = 0.0;
this.deltaTime = .0001;
this.x = 1.0;
this.y = 10;
this.speed = 60.0;
this.ay = -9.8;
this.angle = 45;
this.ax = 0.0;
这是我犯下的一个愚蠢错误,还是我在这里错过了一些关键概念?<