Skip to content

[VRMC_springBone_limit] job 側のロジック実装#2696

Merged
ousttrue merged 7 commits intovrm-c:masterfrom
ousttrue:fix/VRMC_springBone_limit
Jul 18, 2025
Merged

[VRMC_springBone_limit] job 側のロジック実装#2696
ousttrue merged 7 commits intovrm-c:masterfrom
ousttrue:fix/VRMC_springBone_limit

Conversation

@ousttrue
Copy link
Contributor

@ousttrue ousttrue commented Jul 16, 2025

これは
VRMC_springBone_limit
の実装です。

springbone の jobsystem 側のみの実装となっています。
既存システムに影響がないつもりですが、
spring1joint あたり float4x2(32byte) から float4x4 (64byte) の
メモリ消費量の増加があります。

public readonly struct BlittableJointMutable
{
        private readonly float4x2 _data; => float4x4
}

@ousttrue ousttrue force-pushed the fix/VRMC_springBone_limit branch from 63c09c1 to 8cc70b7 Compare July 16, 2025 05:48
@ousttrue ousttrue force-pushed the fix/VRMC_springBone_limit branch from 5408492 to d08e239 Compare July 17, 2025 13:16
@ousttrue ousttrue changed the title [WIP][VRMC_springBone_limit] impl... [VRMC_springBone_limit] impl... Jul 17, 2025
@ousttrue ousttrue changed the title [VRMC_springBone_limit] impl... [VRMC_springBone_limit] job 側のロジック実装 Jul 17, 2025
public float radius => _data.c0.w;


public AnglelimitTypes anglelimitType => (AnglelimitTypes)_data.c2.x;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

デフォルトで 0 詰めされて AnglelimitTypes.None になることを想定しています。
ご指摘あればよろしくお願いします。

@s-iwaki-d s-iwaki-d requested review from Copilot and notargs July 18, 2025 06:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@notargs notargs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大まか問題なさそうです。Copilotがコメントをつけた箇所について確認お願いします~ 🙏

}

// tailDirをphi・thetaを用いて再計算する
return new float3(math.sin(theta), math.cos(theta) * math.cos(phi), math.cos(theta) * math.sin(phi));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍰 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)

などと書くとわかりやすいか

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可読性を捨てて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);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

読めません

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cos_theta 変数作ります。

ousttrue and others added 4 commits July 18, 2025 17:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ousttrue ousttrue requested a review from notargs July 18, 2025 08:32
Copy link
Contributor

@notargs notargs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ousttrue ousttrue merged commit ac49cdd into vrm-c:master Jul 18, 2025
1 check passed
@ousttrue ousttrue deleted the fix/VRMC_springBone_limit branch July 18, 2025 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments