因此,当您向下看 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;
}
有谁知道我怎么能做到这一点?