Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GeneratePhysicRepresentationForMesh causing slow down
#4
(09-09-2019, 10:52 AM)BetaJester Wrote: Right okay

If I create an object in the Scene view, initialise the Obi Cloth, and then create it as a prefab, if I instantiate the prefab at runtime, will the physics work if I don't call GeneratePhysicRepresentationForMesh?

Of course, that's what prefabs are meant to be used for. What GeneratePhysicRepresentationForMesh() does is re-create the entire particle-and-constraint representation of a mesh from scratch. This is very expensive and generally not supposed to be done at runtime unless you're generating entirely procedural actors.

A prefab already contains all this information in serialized form. So you simply instantiate it, assign it to a solver, and you're done. Excerpt from the manual:

Quote:Most of the time actors can be created in the editor, turned into a prefab and instantiated at runtime. However there are situations where creating actors entirely trough code is needed (e.g. procedural level generation). [...goes on to explain how this is done...]
http://obi.virtualmethodstudio.com/tutor...ctors.html
Reply


Messages In This Thread
RE: GeneratePhysicRepresentationForMesh causing slow down - by josemendez - 09-09-2019, 11:41 AM