現在、ワールド ラップでオブジェクトを作成するのに少し問題があります。ある程度は機能しますが、オブジェクトが境界線に引っかかっているように見えることがよくあります。私のラップコードは次のとおりです。
// Wrap our position if we are outside of the world bounds
if (this.state.pos.get(0) > 860) {
this.state.pos.set(0, this.state.pos.get(1));
}
else if (this.state.pos.get(0) < 0) {
this.state.pos.set(860, this.state.pos.get(1));
}
if (this.state.pos.get(1) > 640) {
this.state.pos.set(this.state.pos.get(0), 0);
}
else if (this.state.pos.get(1) < 0) {
this.state.pos.set(this.state.pos.get(0), 640);
}
これを行うより良い方法はありますか?オブジェクトの位置ベクトルを単に設定するのではなく、平行移動を使用する必要がありますか?