[VRMC_springBone_limit] job 側のロジック実装#2696
Conversation
63c09c1 to
8cc70b7
Compare
5408492 to
d08e239
Compare
| public float radius => _data.c0.w; | ||
|
|
||
|
|
||
| public AnglelimitTypes anglelimitType => (AnglelimitTypes)_data.c2.x; |
There was a problem hiding this comment.
デフォルトで 0 詰めされて AnglelimitTypes.None になることを想定しています。
ご指摘あればよろしくお願いします。
There was a problem hiding this comment.
Pull Request Overview
This PR implements the job system logic for VRMC_springBone_limit extension, adding angle limiting functionality to the spring bone physics simulation. The implementation restructures collision detection and introduces comprehensive angle constraint types for spring joints.
Key changes include:
- Implementation of angle limit constraints (Cone, Hinge, Spherical) for spring bone joints
- Refactoring of collision detection logic into a separate SpringBoneCollision class with Try-based methods
- Expansion of BlittableJointMutable memory layout from float4x2 to float4x4 to accommodate new angle limit data
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| UpdateFastSpringBoneJob.cs | Integrates angle limit application and refactored collision detection into the main job execution |
| SpringBoneCollision.cs | New utility class containing extracted collision detection methods with improved Try-based API |
| BlittableJointMutable.cs | Expanded data structure to include angle limit parameters (type, limits, offset) |
| Anglelimit/ folder | Complete angle limiting implementation with different constraint types and mathematical utilities |
Assets/UniGLTF/Runtime/SpringBoneJobs/Anglelimit/AnglelimitCone.cs
Outdated
Show resolved
Hide resolved
notargs
left a comment
There was a problem hiding this comment.
大まか問題なさそうです。Copilotがコメントをつけた箇所について確認お願いします~ 🙏
| } | ||
|
|
||
| // tailDirをphi・thetaを用いて再計算する | ||
| return new float3(math.sin(theta), math.cos(theta) * math.cos(phi), math.cos(theta) * math.sin(phi)); |
There was a problem hiding this comment.
🍰 math.cos(theta)は使いまわせそう。
var thetaFactor = new float2(math.cos(theta), math.sin(theta));
var phiFactor = new float2(math.cos(phi), math.sin(phi));
return new float3(thetaFactor.y, thetaFactor.x * phiFactor.x, thetaFactor.x * phiFactor.y)などと書くとわかりやすいか
There was a problem hiding this comment.
可読性を捨ててBurstを効かせる(ことを期待する)なら一応次のようにも書けそう
var v = math.sin(new float4(theta + math.PIHALF, theta, phi + math.PIHALF, phi));
return new float3(v.y, v.x * v.z, v.x * v.w);Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
これは
VRMC_springBone_limit
の実装です。
springbone の jobsystem 側のみの実装となっています。
既存システムに影響がないつもりですが、
spring1joint あたり float4x2(32byte) から float4x4 (64byte) の
メモリ消費量の増加があります。