mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-14 22:50:08 -05:00
Merge pull request #2470 from ousttrue/fix/springbone0x_center
[0.x][springbone][center] fix center coordinate conversion
This commit is contained in:
commit
675bb7be41
|
|
@ -34,11 +34,9 @@ namespace VRM.SpringBone
|
|||
/// <summary>
|
||||
/// Verlet積分で次の位置を計算する
|
||||
/// </summary>
|
||||
public Vector3 VerletIntegration(float deltaTime, Transform center, Quaternion parentRotation,
|
||||
SpringBoneSettings settings, SpringBoneJointState _state, float scalingFactor, Vector3 externalForce)
|
||||
public Vector3 VerletIntegration(float deltaTime, Quaternion parentRotation,
|
||||
SpringBoneSettings settings, SpringBoneJointState state, float scalingFactor, Vector3 externalForce)
|
||||
{
|
||||
var state = _state.ToWorld(center);
|
||||
|
||||
var nextTail = state.CurrentTail
|
||||
+ (state.CurrentTail - state.PrevTail) * (1.0f - settings.DragForce) // 前フレームの移動を継続する(減衰もあるよ)
|
||||
+ parentRotation * LocalRotation * BoneAxis * settings.StiffnessForce * deltaTime * scalingFactor // 親の回転による子ボーンの移動目標
|
||||
|
|
|
|||
|
|
@ -157,7 +157,8 @@ namespace VRM.SpringBone
|
|||
|
||||
for (int i = 0; i < m_joints.Count; ++i)
|
||||
{
|
||||
var (transform, init, state) = m_joints[i];
|
||||
var (transform, init, _state) = m_joints[i];
|
||||
var state = _state.ToWorld(scene.Center);
|
||||
|
||||
// Spring処理
|
||||
var parentRotation = transform.parent != null ? transform.parent.rotation : Quaternion.identity;
|
||||
|
|
@ -166,7 +167,7 @@ namespace VRM.SpringBone
|
|||
// false の場合
|
||||
// 拡大すると移動速度はだいたい同じ => SpringBone の角速度が遅くなる
|
||||
var scalingFactor = settings.UseRuntimeScalingSupport ? transform.UniformedLossyScale() : 1.0f;
|
||||
var nextTail = init.VerletIntegration(deltaTime, scene.Center, parentRotation, settings, state,
|
||||
var nextTail = init.VerletIntegration(deltaTime, parentRotation, settings, state,
|
||||
scalingFactor, scene.ExternalForce);
|
||||
|
||||
// 長さをboneLengthに強制
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user