因此,当我向下看z轴时,我试图改变物体相对于x轴的轨道角度。看到我的意思:
我目前正在使用此代码围绕两个红色球体进行环绕:
public void orbit() {
theta += this.vel.x;
theta = fixAngle(theta, TWO_PI);
this.loc.x = this.origin.x+orbitRadius*cos(theta);
this.loc.y = this.origin.y+orbitRadius*cos(theta);
this.loc.z = this.origin.z+orbitRadius*sin(theta);
}
private float fixAngle(float ang, float range) {
if (ang < 0)
ang += range;
else if (ang > range)
ang -= range;
return ang;
}
有谁知道我怎么能做到这一点?