mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -04:00
fix skeletal position and animations (chest)
This commit is contained in:
parent
0e68f35ffa
commit
1ca468ac44
@ -91,7 +91,7 @@ class BakedSkeletalModel(
|
||||
companion object {
|
||||
|
||||
fun Vec3.fromBlockCoordinates(): Vec3 {
|
||||
return Vec3(this.x.toBlockCoordinate(), this.y.toBlockCoordinate(), this.z.toBlockCoordinate())
|
||||
return Vec3(this.x.toBlockCoordinate(), this.y / BLOCK_RESOLUTION, this.z.toBlockCoordinate())
|
||||
}
|
||||
|
||||
inline fun Float.toBlockCoordinate(): Float {
|
||||
|
@ -74,8 +74,8 @@ class SkeletalInstance(
|
||||
fun updatePosition(position: Vec3, rotation: EntityRotation) {
|
||||
val matrix = Mat4()
|
||||
.translateAssign(position)
|
||||
.rotateAssign((180.0f - rotation.yaw).toFloat().rad, Vec3(0, 1, 0))
|
||||
.translateAssign(Vec3(-0.5, -0.5, -0.5)) // move to bottom center
|
||||
.rotateAssign((180.0f - rotation.yaw).rad, Vec3(0, 1, 0))
|
||||
.translateAssign(Vec3(-0.5, 0.0f, -0.5)) // move to bottom center
|
||||
|
||||
if (baseTransform != matrix) {
|
||||
baseTransform = matrix
|
||||
|
@ -55,9 +55,9 @@ interface SkeletalAnimation {
|
||||
val rotation = get(KeyframeChannels.ROTATION, outliner, tweakedTime)
|
||||
if (rotation != null && rotation != Vec3.EMPTY_INSTANCE) {
|
||||
transform.translateAssign(outliner.origin.fromBlockCoordinates())
|
||||
transform.rotateAssign(rotation.x.rad, Vec3(1, 0, 0))
|
||||
transform.rotateAssign(rotation.y.rad, Vec3(0, 1, 0))
|
||||
transform.rotateAssign(rotation.z.rad, Vec3(0, 0, 1))
|
||||
transform.rotateAssign(-rotation.x.rad, Vec3(1, 0, 0))
|
||||
transform.rotateAssign(-rotation.y.rad, Vec3(0, 1, 0))
|
||||
transform.rotateAssign(-rotation.z.rad, Vec3(0, 0, 1))
|
||||
transform.translateAssign(-outliner.origin.fromBlockCoordinates())
|
||||
}
|
||||
val scale = get(KeyframeChannels.SCALE, outliner, tweakedTime)
|
||||
|
Loading…
x
Reference in New Issue
Block a user