Fix motion trail on null objects
Fix IK not always resolving correctly
This commit is contained in:
parent
d06f83922b
commit
207353d8c8
@ -885,7 +885,6 @@ const Animator = {
|
||||
start_time = Math.clamp(currentTime - 8, 0, Infinity);
|
||||
max_time = Math.min(max_time, currentTime + 8);
|
||||
}
|
||||
let multiplier = animation.blend_weight ? Math.clamp(Animator.MolangParser.parse(animation.blend_weight), 0, Infinity) : 1;
|
||||
let geometry = new THREE.BufferGeometry();
|
||||
let bone_stack = [];
|
||||
let iterate = g => {
|
||||
@ -906,12 +905,21 @@ const Animator = {
|
||||
|
||||
function displayTime(time) {
|
||||
Timeline.time = time;
|
||||
bone_stack.forEach(group => {
|
||||
var mesh = group.mesh;
|
||||
let multiplier = animation.blend_weight ? Math.clamp(Animator.MolangParser.parse(animation.blend_weight), 0, Infinity) : 1;
|
||||
|
||||
bone_stack.forEach(node => {
|
||||
let mesh = node.mesh;
|
||||
let ba = animation.getBoneAnimator(node)
|
||||
|
||||
if (mesh.fix_rotation) mesh.rotation.copy(mesh.fix_rotation)
|
||||
if (mesh.fix_position) mesh.position.copy(mesh.fix_position)
|
||||
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
|
||||
animation.getBoneAnimator(group).displayFrame(multiplier);
|
||||
|
||||
if (node instanceof NullObject) {
|
||||
if (!ba.muted.position) ba.displayPosition(ba.interpolate('position'), multiplier);
|
||||
} else {
|
||||
mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
|
||||
ba.displayFrame(multiplier);
|
||||
}
|
||||
})
|
||||
target.mesh.updateWorldMatrix(true, false)
|
||||
}
|
||||
@ -925,7 +933,7 @@ const Animator = {
|
||||
displayTime(time);
|
||||
let position = target instanceof Group
|
||||
? THREE.fastWorldPosition(target.mesh, new THREE.Vector3())
|
||||
: target.getWorldCenter();
|
||||
: target.getWorldCenter(true);
|
||||
position = position.toArray();
|
||||
line_positions.push(...position);
|
||||
|
||||
|
@ -480,9 +480,6 @@ class NullObjectAnimator extends BoneAnimator {
|
||||
let ik_target = new THREE.Vector3().copy(null_object.getWorldCenter(true));
|
||||
let bone_references = [];
|
||||
let current = target.parent;
|
||||
|
||||
this.solver.clear();
|
||||
this.chain.clear();
|
||||
|
||||
while (current !== null_object.parent) {
|
||||
bones.push(current);
|
||||
@ -545,6 +542,10 @@ class NullObjectAnimator extends BoneAnimator {
|
||||
}
|
||||
}
|
||||
})
|
||||
this.solver.clear();
|
||||
this.chain.clear();
|
||||
this.chain.lastTargetLocation.set(1e9, 0, 0);
|
||||
|
||||
if (get_samples) return results;
|
||||
}
|
||||
displayFrame(multiplier = 1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user