Bone-attachment fix for first person
This commit is contained in:
		
							parent
							
								
									935fd54a9b
								
							
						
					
					
						commit
						b70e7645fd
					
				| @ -238,7 +238,7 @@ | |||||||
|                     "equipPointId" : "handRight", |                     "equipPointId" : "handRight", | ||||||
|                     "bone" : "Hand.R", |                     "bone" : "Hand.R", | ||||||
|                     "firstPersonBone" : "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], |                     "offsetVectorThirdPerson" : [0.02,-0.06,0], | ||||||
|                     "offsetRotationThirdPerson" : [-0.334,0.145,-0.28,0.89], |                     "offsetRotationThirdPerson" : [-0.334,0.145,-0.28,0.89], | ||||||
|                     "offsetRotationFirstPerson" : [0.02,-0.977,-0.211,-0.005], |                     "offsetRotationFirstPerson" : [0.02,-0.977,-0.211,-0.005], | ||||||
|  | |||||||
| @ -309,10 +309,11 @@ public class AttachUtils { | |||||||
|         Vector3d facingVector |         Vector3d facingVector | ||||||
|     ){ |     ){ | ||||||
|         //transform bone space |         //transform bone space | ||||||
|         Vector3d position = new Vector3d(bonePosition); |         Vector3d position = new Vector3d(offsetVector); | ||||||
|         position = position.add(offsetVector); |         position = position.rotate(new Quaterniond(boneRotation)); | ||||||
|  |         position = position.add(bonePosition); | ||||||
|         position = position.mul(parentScale); |         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 |         //transform worldspace | ||||||
|         position.add(parentPosition); |         position.add(parentPosition); | ||||||
|         //set |         //set | ||||||
| @ -324,7 +325,8 @@ public class AttachUtils { | |||||||
|         } |         } | ||||||
|         //calculate rotation of model |         //calculate rotation of model | ||||||
|         EntityUtils.getRotation(child) |         EntityUtils.getRotation(child) | ||||||
|             .rotationTo(MathUtils.getOriginVector(), new Vector3d(facingAngle.x,facingAngle.y,facingAngle.z)) |             .identity() | ||||||
|  |             .mul(parentRotation) | ||||||
|             .mul(boneRotation) |             .mul(boneRotation) | ||||||
|             .mul(offsetRotation) |             .mul(offsetRotation) | ||||||
|             .normalize(); |             .normalize(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user