mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-12 06:41:51 +09:00
former bug fixed; now we have ceiling-stair-clip bug
This commit is contained in:
@@ -632,7 +632,7 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
|
|||||||
debug1("Collision type: $selfCollisionStatus")
|
debug1("Collision type: $selfCollisionStatus")
|
||||||
affectingTiles.forEach {
|
affectingTiles.forEach {
|
||||||
val tileCoord = LandUtil.resolveBlockAddr(it)
|
val tileCoord = LandUtil.resolveBlockAddr(it)
|
||||||
debug1("affectign tile: ${tileCoord.first}, ${tileCoord.second}")
|
debug2("affectign tile: ${tileCoord.first}, ${tileCoord.second}")
|
||||||
}
|
}
|
||||||
|
|
||||||
when (selfCollisionStatus) {
|
when (selfCollisionStatus) {
|
||||||
@@ -694,6 +694,9 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
|
|||||||
Vector2(offendingTileWorldX, offendingTileWorldY)).direction
|
Vector2(offendingTileWorldX, offendingTileWorldY)).direction
|
||||||
|
|
||||||
|
|
||||||
|
debug1("vectorSum: $vectorSum, vectorDirRaw: ${vectorSum.direction / Math.PI}pi")
|
||||||
|
debug1("incidentAngle: ${angleOfIncidence / Math.PI}pi, threshold: ${angleThreshold / Math.PI}pi")
|
||||||
|
|
||||||
|
|
||||||
val displacementAbs = Vector2(
|
val displacementAbs = Vector2(
|
||||||
(offendingTileWorldX - offendingHitboxPointX).abs(),
|
(offendingTileWorldX - offendingHitboxPointX).abs(),
|
||||||
@@ -729,6 +732,9 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
|
|||||||
newHitbox.translate(finalDisplacement)
|
newHitbox.translate(finalDisplacement)
|
||||||
|
|
||||||
|
|
||||||
|
debug1("displacement: $finalDisplacement")
|
||||||
|
|
||||||
|
|
||||||
// TODO: translate other axis proportionally to the incident vector
|
// TODO: translate other axis proportionally to the incident vector
|
||||||
|
|
||||||
bounceX = angleOfIncidence == angleThreshold || displacementUnitVector.x != 0.0
|
bounceX = angleOfIncidence == angleThreshold || displacementUnitVector.x != 0.0
|
||||||
@@ -1438,9 +1444,9 @@ open class ActorWithPhysics(renderOrder: RenderOrder, val immobileBody: Boolean
|
|||||||
speedMultByTile *
|
speedMultByTile *
|
||||||
scale.sqrt()
|
scale.sqrt()
|
||||||
|
|
||||||
private fun Double.toPositiveRad() = // rad(0..2pi, -2pi..0) -> rad(0..4pi)
|
private fun Double.toPositiveRad() = // rad(0..pi, -pi..0) -> rad(0..2pi)
|
||||||
if (this >= -2 * Math.PI && this < 0.0)
|
if (-Math.PI <= this && this < 0.0)
|
||||||
4 * Math.PI - this
|
this + 2 * Math.PI
|
||||||
else
|
else
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user