Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
139 stars 2 forks source link

Bhaptics periodically not working #1807

Open ultrawidegamer opened 6 months ago

ultrawidegamer commented 6 months ago

Describe the bug?

when wearing bhaptics and colliding with an item that has a HapticTrigger collider on it, the bhaptics gear will periodically not trigger and throw an error in the logs

To Reproduce

wear bhaptics and attempt to collide with objects with HapticTrigger colliders on them

Expected behavior

Bhaptics works with HapticTrigger colliders

Screenshots

No response

Resonite Version Number

2024.4.18.1398

What Platforms does this occur on?

Windows

What headset if any do you use?

No response

Log Files

1:31:47 AM.802 ( 36 FPS)    Exception in ContactStart
Offset: [0; 0; 0], SphereCollider - BepuAllocated: True, BepuHandle: 54, RegisteredType: HapticSampler, Type: HapticSampler, Owner: 
Element: IDF252DFF, Type: FrooxEngine.SphereCollider, World: Phant World, IsRemoved: False, IsDestroyed: False, IsDisposed: False, Enabled: True
Element: IDF2522FF, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: Collider, T: [0; 0; 0], R: [0; 0; 0; 1], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID11C83802, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: HapticPoint, T: [-0.3143846; 0.4755704; -0.4191794], R: [0; 0; 0; 1], S: [8.383596; 8.383596; 8.383596], ActiveSelf: True, IsDestroyed: False
Element: ID113B7B02, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: spine1, T: [-9.363714E-15; 0.689738; -3.501628E-07], R: [0.03363631; -0.0002303421; 0.0003218066; 0.9994341], S: [1; 0.9999999; 0.9999999], ActiveSelf: True, IsDestroyed: False
Element: ID113B6502, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: root, T: [0.06646242; -0.3467337; 3.822338], R: [0.7053368; -5.499379E-05; 0.0001098667; 0.7088723], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID113B5A02, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: Armature, T: [0; 0; 0], R: [-0.7071069; 0; 0; 0.7071068], S: [100; 100; 100], ActiveSelf: True, IsDestroyed: False
Element: ID113A8102, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: RootNode, T: [0.0001626876; 6.939598E-05; -28.54762], R: [0; -2.439611E-15; 0; 1], S: [0.9999999; 0.9999999; 0.9999999], ActiveSelf: True, IsDestroyed: False
Element: ID113A6B02, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: CenteredRoot, T: [13.52764; 0.0005528012; -341.6309], R: [1.186717E-06; 0.08311146; -4.584367E-07; -0.9965402], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID11365102, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: NaviMaster.fbx, T: [0; 0; 0], R: [0; 0; 0; 1], S: [0.0024273; 0.0024273; 0.0024273], ActiveSelf: True, IsDestroyed: False
Element: ID6345E500, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: User <noparse=8>navy3001 (ID2B117C00), T: [-4.653067; 434.201; -1.530211], R: [0.6269096; 0.7600493; -0.06623925; -0.1578673], S: [0.8889872; 0.8889896; 0.8889872], ActiveSelf: True, IsDestroyed: False
Element: ID2400, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: Root, T: [0; 0; 0], R: [0; 0; 0; 1], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID0, Type: FrooxEngine.World, World: Phant World, IsRemoved: False

System.ArgumentException: An item with the same key has already been added. Key: Offset: [0; 0; 0], SphereCollider - BepuAllocated: True, BepuHandle: 152, RegisteredType: HapticSampler, Type: HapticSampler, Owner: 
Element: IDF2415FF, Type: FrooxEngine.SphereCollider, World: Phant World, IsRemoved: False, IsDestroyed: False, IsDisposed: False, Enabled: True
Element: IDF240AFF, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: Collider, T: [0; 0; 0], R: [0; 0; 0; 1], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID11C70C02, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: HapticPoint, T: [0.8383593; 0.2219634; 0.8383596], R: [0; 0; 0; 1], S: [8.383595; 8.383595; 8.383595], ActiveSelf: True, IsDestroyed: False
Element: ID113B6502, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: root, T: [0.06646242; -0.3467337; 3.822338], R: [0.7053368; -5.499379E-05; 0.0001098667; 0.7088723], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID113B5A02, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: Armature, T: [0; 0; 0], R: [-0.7071069; 0; 0; 0.7071068], S: [100; 100; 100], ActiveSelf: True, IsDestroyed: False
Element: ID113A8102, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: RootNode, T: [0.0001626876; 6.939598E-05; -28.54762], R: [0; -2.439611E-15; 0; 1], S: [0.9999999; 0.9999999; 0.9999999], ActiveSelf: True, IsDestroyed: False
Element: ID113A6B02, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: CenteredRoot, T: [13.52764; 0.0005528012; -341.6309], R: [1.186717E-06; 0.08311146; -4.584367E-07; -0.9965402], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID11365102, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: NaviMaster.fbx, T: [0; 0; 0], R: [0; 0; 0; 1], S: [0.0024273; 0.0024273; 0.0024273], ActiveSelf: True, IsDestroyed: False
Element: ID6345E500, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: User <noparse=8>navy3001 (ID2B117C00), T: [-4.653067; 434.201; -1.530211], R: [0.6269096; 0.7600493; -0.06623925; -0.1578673], S: [0.8889872; 0.8889896; 0.8889872], ActiveSelf: True, IsDestroyed: False
Element: ID2400, Type: FrooxEngine.Slot, World: Phant World, IsRemoved: False, Slot name: Root, T: [0; 0; 0], R: [0; 0; 0; 1], S: [1; 1; 1], ActiveSelf: True, IsDestroyed: False
Element: ID0, Type: FrooxEngine.World, World: Phant World, IsRemoved: False

  at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x000c1] in <9577ac7a62ef43179789031239ba8798>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 
  at FrooxEngine.HapticPointSamplerBase.OnContactStart (FrooxEngine.ICollider collider, FrooxEngine.ICollider other) [0x0001b] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.Collider.RunContactStart (FrooxEngine.ICollider other) [0x0000a] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 

  at System.Environment.get_StackTrace () [0x00000] in <9577ac7a62ef43179789031239ba8798>:0 
  at Elements.Core.UniLog.Error (System.String message, System.Boolean stackTrace) [0x00000] in <d0f719fde2d54f35960f4295d85114e3>:0 
  at FrooxEngine.DebugManager.Error (System.Object obj, System.Boolean stackTrace) [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.Collider.RunContactStart (FrooxEngine.ICollider other) [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.ContactEventManager+<>c.<.cctor>b__63_0 (FrooxEngine.ICollider self, FrooxEngine.ICollider other) [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.ContactEventManager.DispatchEvent (BepuPhysics.BodyHandle eventSourceBody, BepuPhysics.Collidables.CollidableReference other, FrooxEngine.ContactEventManager+ColliderEventHandler handler, System.Boolean flagAsTouched) [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.ContactEventManager.DispatchEvents (BepuUtilities.Collections.QuickList`1[FrooxEngine.ContactEventManager+CollisionEvent][]& events, FrooxEngine.ContactEventManager+ColliderEventHandler handler, System.Boolean flagAsTouched) [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.ContactEventManager.DispatchEvents () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.PhysicsSimulation.FinishUpdate () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.PhysicsManager.Update () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.World.RefreshStep () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.World.Refresh () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.WorldManager.UpdateStep () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.WorldManager.RunUpdateLoop () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.Engine.UpdateStep () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.Engine.RunUpdateLoop () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at UnityFrooxEngineRunner.FrooxEngineRunner.UpdateFrooxEngine () [0x00000] in <e4fcaba15f494d6a883069aee19e9c93>:0 
  at UnityFrooxEngineRunner.FrooxEngineRunner.Update () [0x00000] in <e4fcaba15f494d6a883069aee19e9c93>:0 

Additional Context

No response

Reporters

ultrawidegamer, navy3001

ohzee00 commented 6 months ago

While those log snips are showing the issue, please do give full logs for these things, they give a bunch of possibly relevant information that could help solve the issue you're reporting.

shiftyscales commented 6 months ago

As @ohzee00 noted above and per our reporting requirements, please submit full log files with any issue you create, @ultrawidegamer.

Are HapticTrigger colliders the only kind that have issues? How is it configured? Does it have any filters applied, etc? Does the same occur with HapticStaticTrigger? Does the type of primitive collider matter/affect things? E.g. Sphere vs Box, etc.

If you are able to determine if this only happens with certain collider shapes/types/certain configurations- that would help a lot.

navy3001 commented 6 months ago

Haptic Triggers are only effected. No filters applyed. HapticStaitcTrigger works fine If i recall correctly, Cube and Sphere where the issues, when I tried cylinder, it worked.

And, As requested, here is the FULL log.

DESKTOP-NHBNSCC - 2024.4.18.1398 - 2024-04-21 23_38_35.log

@shiftyscales

shiftyscales commented 6 months ago

I see- so it seemingly only is an issue that applies to haptic triggers on sphere/cube colliders?

Could you please create a replication world with all possible combinations of HapticTrigger, and HapticStaticTrigger colliders so we can know with more certainty which collider shapes and types are affected? @ultrawidegamer @navy3001

If this issue only affects certain combinations- it would be good to be certain on which colider shapes and types precisely are affected.

Does this issue only occur with bHaptics, or does it also occur with other haptic sources too, e.g. controller haptics?

ultrawidegamer commented 6 months ago

Controller haptics appear to be unaffected and work as expected

shiftyscales commented 6 months ago

That's unfortunate. I don't have the hardware to test it myself. But yes, it would be helpful then to please isolate all of the possible combinations that have issues.

ultrawidegamer commented 6 months ago

After further testing, it seems to be a localized issue, which really surprised me. When using a HapticTrigger that @navy3001 was not able to feel with his bhaptics, I was able to see the data update on a VirtualHapticPointSampler, but he was not able to see the same data change while looking at that same VirtualHapticPointSampler.

Additionally, there appears to be no discernible pattern as to when the haptics will stop working. We tried placing about 1000 different HapticTrigger objects in different scenarios without any pattern, and eventually all new haptics appeared to be working as expected, with previously spawned out broken ones still remaining broken.

Furthermore, we have determined that after saving and reopening the world in which the item was spawned, it will always work, even if it was an item that previously did not work in that world. Controller haptics nor HapticStaticTrigger appear to be affected by this issue; only HapticTrigger colliders seem to be affected.

shiftyscales commented 5 months ago

I see. Prior to saving/reloading the world, are all HapticTrigger colliders broken, even freshly made/duplicated ones? Or is it just specific colliders in the scene which have issues? From the sounds of it- the HapticTrigger colliders are not being properly registered in Bepu until the world is saved/reset, where it gets linked up properly.

In the case you mentioned, were you the host, or a client, @ultrawidegamer?

If so, I wonder if it can be nailed down further, e.g. HapticTrigger colliders not being properly registered for remote clients when they are made in the session, rather than being pre-existing when the user joins.

To follow on that line of thinking- if it only affects remote users- do the colliders get fixed if the user leaves and re-joins, @ultrawidegamer?