2011-11-10 50 views
0

所以我试图改变物体轨道相对于X轴的角度,因为您正在向下看Z轴。看到我的意思图片:Angles改变三维轨道物体相对于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; 
    } 

没有人知道我可以做到这一点?

回答

1

显然它可以通过不旋转轨道对象来完成,但是通过旋转坐标系来回答HERE