diff --git a/assets/Data/creatures/human.json b/assets/Data/creatures/human.json index 50ea5e8b..68b4841b 100644 --- a/assets/Data/creatures/human.json +++ b/assets/Data/creatures/human.json @@ -238,7 +238,7 @@ "equipPointId" : "handRight", "bone" : "Hand.R", "firstPersonBone" : "hand.R", - "offsetVectorFirstPerson" : [-0.05,0.04,-0.09], + "offsetVectorFirstPerson" : [-0.01,-0.05,-0.10], "offsetVectorThirdPerson" : [0.02,-0.06,0], "offsetRotationThirdPerson" : [-0.334,0.145,-0.28,0.89], "offsetRotationFirstPerson" : [0.02,-0.977,-0.211,-0.005], diff --git a/src/main/java/electrosphere/entity/types/attach/AttachUtils.java b/src/main/java/electrosphere/entity/types/attach/AttachUtils.java index 3bb56ac4..2c188dee 100644 --- a/src/main/java/electrosphere/entity/types/attach/AttachUtils.java +++ b/src/main/java/electrosphere/entity/types/attach/AttachUtils.java @@ -309,10 +309,11 @@ public class AttachUtils { Vector3d facingVector ){ //transform bone space - Vector3d position = new Vector3d(bonePosition); - position = position.add(offsetVector); + Vector3d position = new Vector3d(offsetVector); + position = position.rotate(new Quaterniond(boneRotation)); + position = position.add(bonePosition); position = position.mul(parentScale); - position = position.rotate(new Quaterniond(parentRotation.x,parentRotation.y,parentRotation.z,parentRotation.w)); + position = position.rotate(new Quaterniond(parentRotation)); //transform worldspace position.add(parentPosition); //set @@ -324,7 +325,8 @@ public class AttachUtils { } //calculate rotation of model EntityUtils.getRotation(child) - .rotationTo(MathUtils.getOriginVector(), new Vector3d(facingAngle.x,facingAngle.y,facingAngle.z)) + .identity() + .mul(parentRotation) .mul(boneRotation) .mul(offsetRotation) .normalize();