2011-11-10 88 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