Vector3 basisSide, Vector3 basisUp, Vector3 basisForward, float springStrength, float deltaTime, ref Vector3 vector) { var upProjection = Vector3.Project(vector, basisUp); var projection = vector - upProjection; var projectionMagnitude = projection.magnitude; var originalSine = Vector3.Dot(projection/projectionMagnitude, basisSide); // The above math might have a bit of floating point error // so clamp the sine value into a valid range so we don't get NaN later originalSine = Mathf.Clamp(originalSine, -1f, 1f); // Use soft limits based on Hooke's Law to reduce jitter, // then apply hard limits var newAngle = Mathf.Rad2Deg * Mathf.Asin(originalSine); var acceleration = -newAngle * springStrength; newAngle += acceleration * deltaTime * deltaTime; // ③ var minAngle = min; var maxAngle = max; var preClampAngle = newAngle; newAngle = Mathf.Clamp(newAngle, minAngle, maxAngle); // Apply falloff var curveLimit = (newAngle < 0f) ? minAngle : maxAngle; newAngle = ComputeFalloff(newAngle, curveLimit) * curveLimit; var radians = Mathf.Deg2Rad * newAngle; var newProjection = Sin(radians) * basisSide + Cos(radians) * basisForward; newProjection *= projectionMagnitude; vector = newProjection + upProjection; return newAngle != preClampAngle; } STEP.1 入力のBoneベクトルからside-foward 平面上のfowerdとの成す角(sin-angle)を 計算 STEP.2 角度空間(1D)上で、angleを0°方向へバ ネモデルで引っ張る STEP.3 減衰…と見せかけて何もしません! (実装ミス????) STEP.4 angleからBoneのベクトルを再構築 ※ angleはforwardからの角度のヨー成分
is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. https://github.com/unity3d-jp/UnityChanSpringBone/blob/dev/main/LICENSE SpringBone ライセンス表記