Hello Guest

Author Topic: SpriteCollection collider type polygon error  (Read 5862 times)

archerxy

  • Newbie
  • *
  • Posts: 1
    • View Profile
SpriteCollection collider type polygon error
« on: February 04, 2013, 09:38:26 am »
sorry,my english is very poor.
when i make SpriteCollection
step1. create SpriteCollection, then i put pictures in.
step2. select a sprite, set Collider Type to "Polygon" and Commit.
The editor show error:

Code: [Select]
Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually!
UnityEngine.GameObject:AddComponent()
tk2dBaseSprite:CreateCollider() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:438)
tk2dBaseSprite:EditMode__CreateCollider() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:498)
tk2dBaseSprite:ForceBuild() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:530)
tk2dSprite:ForceBuild() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSprite.cs:221)
tk2dSpriteCollectionBuilder:RefreshExistingAssets(tk2dSpriteCollectionData) (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteCollectionBuilder.cs:1178)
tk2dSpriteCollectionBuilder:Rebuild(tk2dSpriteCollection) (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteCollectionBuilder.cs:1128)
tk2dSpriteCollectionEditorPopup:Commit() (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:432)
tk2dSpriteCollectionEditorPopup:DrawToolbar() (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:422)
tk2dSpriteCollectionEditorPopup:OnGUI() (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:815)
UnityEditor.DockArea:OnGUI()
What's the error mean? Please help me. Thank you very much.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: SpriteCollection collider type polygon error
« Reply #1 on: February 04, 2013, 10:54:39 pm »
This error is due to an issue in Unity where it doesn't like "flat" meshes like sprites, and when you have polygon colliders attached.
It is not a fatal error - it is resolved very soon after the message is printed, but there isn't any way to turn off the message. It is safe to ignore though - until it gets fixed properly.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: SpriteCollection collider type polygon error
« Reply #2 on: May 31, 2013, 08:38:33 am »
Happens to me as well, on a non-animated polygon collider.

Code: [Select]
Actor::updateMassFromShapes: Compute mesh inertia tensor failed for one of the actor's mesh shapes! Please change mesh geometry or supply a tensor manually!
UnityEngine.GameObject:AddComponent()
tk2dBaseSprite:CreateCollider() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:556)
tk2dBaseSprite:EditMode__CreateCollider() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:616)
tk2dBaseSprite:ForceBuild() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:648)
tk2dSprite:ForceBuild() (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSprite.cs:230)
tk2dSpriteCollectionBuilder:RefreshExistingAssets(tk2dSpriteCollectionData) (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteCollectionBuilder.cs:1210)
tk2dSpriteCollectionBuilder:Rebuild(tk2dSpriteCollection) (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteCollectionBuilder.cs:1162)
tk2dSpriteCollectionEditorPopup:Commit() (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:437)
tk2dSpriteCollectionEditorPopup:DrawToolbar() (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:427)
tk2dSpriteCollectionEditorPopup:OnGUI() (at Assets/TK2DROOT/tk2d/Editor/Sprites/SpriteCollectionEditor/tk2dSpriteCollectionEditorPopup.cs:826)
UnityEditor.DockArea:OnGUI()

The thing is, it did not happen for a while, then it started happening, and it does not go away.
( Unity 3.5, Toolkit 1.92 final + patch 1 )

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: SpriteCollection collider type polygon error
« Reply #3 on: May 31, 2013, 10:15:14 am »
I believe this is to do with whether there is an instance in the scene with a rigidbody or not. All the appraches to solve this are hacks as far as I know, but the next collider update should fix it properly. Its not REALLY an issue, just Unity whinging about not being able to calculate an inertia tensor for a flat object. Why its calculating it from the render mesh is beyond me...

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: SpriteCollection collider type polygon error
« Reply #4 on: May 31, 2013, 10:19:37 am »
:)

Fair enough. Just thought I'd mention it for posterity's sake.