You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-20 15:36:18 +00:00
🆙 small fix delay in walking in front of the window
This commit is contained in:
@@ -929,17 +929,38 @@ export class RoomPlane implements IRoomPlane
|
|||||||
const normalX = (normal2DLength > 0.0001) ? (this._normal.x / normal2DLength) : 0;
|
const normalX = (normal2DLength > 0.0001) ? (this._normal.x / normal2DLength) : 0;
|
||||||
const normalY = (normal2DLength > 0.0001) ? (this._normal.y / normal2DLength) : 0;
|
const normalY = (normal2DLength > 0.0001) ? (this._normal.y / normal2DLength) : 0;
|
||||||
const normalFacingDot = Math.abs((facingX * normalX) + (facingY * normalY));
|
const normalFacingDot = Math.abs((facingX * normalX) + (facingY * normalY));
|
||||||
const useOppositeTexture = (shouldMirror && (normalFacingDot > 0.7));
|
|
||||||
|
|
||||||
const sprite = new Sprite((useOppositeTexture ? (oppositeTexture || texture) : texture));
|
const transitionLow = 0.6;
|
||||||
sprite.anchor.set(0.5, 1);
|
const transitionHigh = 0.8;
|
||||||
sprite.position.set(Math.trunc(x), Math.trunc(y));
|
let oppositeWeight = 0;
|
||||||
|
|
||||||
sprite.scale.set(1, 1);
|
if(shouldMirror && oppositeTexture)
|
||||||
sprite.tint = 0xCFE3FF;
|
{
|
||||||
sprite.alpha = alpha;
|
if(normalFacingDot >= transitionHigh) oppositeWeight = 1;
|
||||||
|
else if(normalFacingDot > transitionLow) oppositeWeight = (normalFacingDot - transitionLow) / (transitionHigh - transitionLow);
|
||||||
|
}
|
||||||
|
|
||||||
container.addChild(sprite);
|
if(oppositeWeight < 1)
|
||||||
|
{
|
||||||
|
const sprite = new Sprite(texture);
|
||||||
|
sprite.anchor.set(0.5, 1);
|
||||||
|
sprite.position.set(Math.trunc(x), Math.trunc(y));
|
||||||
|
sprite.scale.set(1, 1);
|
||||||
|
sprite.tint = 0xCFE3FF;
|
||||||
|
sprite.alpha = alpha * (1 - oppositeWeight);
|
||||||
|
container.addChild(sprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(oppositeWeight > 0 && oppositeTexture)
|
||||||
|
{
|
||||||
|
const sprite = new Sprite(oppositeTexture);
|
||||||
|
sprite.anchor.set(0.5, 1);
|
||||||
|
sprite.position.set(Math.trunc(x), Math.trunc(y));
|
||||||
|
sprite.scale.set(1, 1);
|
||||||
|
sprite.tint = 0xCFE3FF;
|
||||||
|
sprite.alpha = alpha * oppositeWeight;
|
||||||
|
container.addChild(sprite);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user