Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  When update Mesh Colliders can't update Obi Collider
#1
Hi,
I refer to this thread to make meshCollider update, but ObiCollider does not refresh
Know that meshCollider is expensive so useful use distance fields 

I would like to ask how to update the MeshCollider of ObiCollider? Because I am developing an adult game, I can't post a screenshot here

[Offline Rendering] update Mesh Colliders (virtualmethodstudio.com)
Reply
#2
(24-05-2023, 12:50 PM)jeffLin Wrote: Hi,
I refer to this thread to make meshCollider update, but ObiCollider does not refresh
Know that meshCollider is expensive so useful use distance fields 

I would like to ask how to update the MeshCollider of ObiCollider? Because I am developing an adult game, I can't post a screenshot here

[Offline Rendering] update Mesh Colliders (virtualmethodstudio.com)

Hi there,

You must call:

Code:
((ObiMeshShapeTracker)obiCollider.Tracker).UpdateMeshData();

kind regards,
Reply
#3
(24-05-2023, 02:46 PM)約瑟門德斯 Wrote: 你好,你必須打電話:


親切的問候,


Code:
((ObiMeshShapeTracker)obiCollider.Tracker).UpdateMeshData();
Code:
var tracker = obiCollider.Tracker;
(tracker as ObiMeshShapeTracker).UpdateMeshData();


執行此後,將報告網格碰撞體為空的錯誤
[附件=1788][附件=1789][附件=1790][附件=1791]


Attached Files Thumbnail(s)
               
Reply
#4
(24-05-2023, 04:37 PM)jeffLin Wrote:
Code:
var tracker = obiCollider.Tracker;
(tracker as ObiMeshShapeTracker).UpdateMeshData();


執行此後,將報告網格碰撞體為空的錯誤
[附件=1788][附件=1789][附件=1790][附件=1791]

Your collider is using a distance field, but your code expects a MeshCollider. Since you’re trying to cast a distance field tracker to a mesh collider tracker, it fails (with either a failed cast, or a null exception when using the “as” operator).

Remove the “H (Obi Distance Field)” asset from your ObiCollider component, making sure the field shows “None”. This will revert it back to using the MeshCollider.

You can’t use both MeshCollider and a distance field (as it doesn’t make sense), they’re mutually exclusive.
Reply