Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reduce particles after blueprint created
#1
Hi Obi,

we have an rabbit using obi softbody, but we want more efficiency, so we want to reduce particles in specified part, for a rabbit we just want it's ears more soft, but want to reduce other body part's particles. 

we successfully deleted the particles (keep the bones particles) and updated the blueprint, but so sad when we start to run , error occured and even ai dont know why: 


IndexOutOfRangeException: Reading from index 7926 is out of range of '7920' Capacity.
Obi.ObiNativeList1[T].get_Item (System.Int32 index) (at Assets/Obi/Scripts/Common/DataStructures/NativeList/ObiNativeList.cs:86)
Obi.ObiShapeMatchingConstraintsBatch.Merge (Obi.ObiActor actor, Obi.IObiConstraintsBatch other) (at Assets/Obi/Scripts/Common/Blueprints/Constraints/Batches/ObiShapeMatchingConstraintsBatch.cs:179)
Obi.ObiConstraints1[T].Merge (Obi.ObiActor actor, Obi.IObiConstraints other) (at Assets/Obi/Scripts/Common/Blueprints/Constraints/ObiConstraints.cs:58)
Obi.ObiSolver.PushConstraints () (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:2230)
Obi.ObiSolver.StartSimulation (System.Single stepDelta, System.Int32 simulationSteps) (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1647)
Obi.ObiSolver.LateUpdate () (at Assets/Obi/Scripts/Common/Solver/ObiSolver.cs:1169)

the main problem is that looks like when we recreated(updated) the blueprint, something wrong in formart, or the blueprint modified after bind ?? 

so is it possible to make this happen, or any tips for us, especially which part of obi codes need to read ??
Reply
#2
Hi,

If you wish to delete particles after the blueprint has been generated, you also need to delete all references to those particles: constraints referencing them, entries in the skinmap, . Otherwise you'll get OutOfRangeExceptions when these constraints attempt to access particles that no longer exist.

See ObiSurfaceSoftbodyBlueprint.cs. Make sure the batches in shapeMatchingConstraintsData contain no particle indices of particles you deleted. Also, the m_Skinmap object that holds influences of particles over mesh vertices should be recreated anew by calling its MapParticlesToVertices(); once you've deleted the particles.

kind regards,
Reply