Skip to content

Commit

Permalink
Merge pull request #1331 from anatawa12/animation-animating-coliders-…
Browse files Browse the repository at this point in the history
…generated-by-vrc-station

fix: animation bindings for BoxCollider generated by VRCStation will be removed
  • Loading branch information
anatawa12 authored Nov 6, 2024
2 parents 595ff27 + 2bab067 commit 040d995
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The format is based on [Keep a Changelog].
### Removed

### Fixed
- Animation bindings for BoxCollider generated by VRCStation will be removed `#1331`
- This might break the GogoLoco or other flying avatar that supports Quest / Android.

### Security

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ The format is based on [Keep a Changelog].
- Fix non-VRChat project support `#1310`
- 'shader' doesn't have a float or range property 'prop' error `#1312`
- Error if all components are on inactive GameObject `#1318`
- Animation bindings for BoxCollider generated by VRCStation will be removed `#1331`
- This might break the GogoLoco or other flying avatar that supports Quest / Android.

### Security

Expand Down
19 changes: 19 additions & 0 deletions Editor/ObjectMapping/AnimationObjectMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,26 @@ public MappedGameObjectInfo(ObjectMapping objectMapping, string? newPath, Before

var component = EditorUtility.InstanceIDToObject(instanceId);
if (!component)
{
#if AAO_VRCSDK3_AVATARS
// See https://github.com/anatawa12/AvatarOptimizer/issues/1330
// Some flying avatar gimmicks use VRCStation to make the Collider for flying.
// (Box Collider is not whitelisted for quest avatars)
// Therefore, we need to keep animation bindings for BoxCollider (and Collider) if
// the GameObject has VRCStation component.
if (type == typeof(BoxCollider) || type == typeof(Collider))
{
var (stationInstanceId, _) = gameObjectInfo.GetComponentByType(typeof(VRC.SDK3.Avatars.Components.VRCStation));
if (EditorUtility.InstanceIDToObject(stationInstanceId) != null)
{
goto componentLive;
}
}
#endif

return Array.Empty<(string path, Type type, string propertyName)>(); // this means removed
}
componentLive:;

if (gameObjectInfo.NewPath == null) return Array.Empty<(string path, Type type, string propertyName)>();
if (path == gameObjectInfo.NewPath) return null;
Expand Down

0 comments on commit 040d995

Please sign in to comment.