Obi Official Forum

Full Version: particle properties at Runtime
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I have a script that generates an ObiSkinnedClothBlueprint at runtime.

How could I set the particle properties(Skin backdrop, Skin radius) of the generated blueprint at runtime?

[attachment=2013]
(26-03-2024, 08:12 AM)Nightfall Wrote: [ -> ]Hi!

I have a script that generates an ObiSkinnedClothBlueprint at runtime.

How could I set the particle properties(Skin backdrop, Skin radius) of the generated blueprint at runtime?

Hi!

See: http://obi.virtualmethodstudio.com/manua...aints.html
(26-03-2024, 08:34 AM)josemendez Wrote: [ -> ]Hi!

See: http://obi.virtualmethodstudio.com/manua...aints.html

I was writing code based on a link like below
Code:
var obiSkinnedCloth = assetObject.AddComponent<ObiSkinnedCloth>();
var blueprint = ScriptableObject.CreateInstance<ObiSkinnedClothBlueprint>();

blueprint.inputMesh = meshFilter.mesh;
blueprint.GenerateImmediate();

var actorConstraints = obiSkinnedCloth.GetConstraintsByType(Oni.ConstraintType.Skin)
    as ObiConstraints<ObiSkinConstraintsBatch>;

var solverConstraints = obiSkinnedCloth.solver.GetConstraintsByType(Oni.ConstraintType.Skin)
    as ObiConstraints<ObiSkinConstraintsBatch>;

var actorSkinBatch = actorConstraints.batches[0];
var solverSkinBatch = solverConstraints.batches[0];

but I encountered a NullReferenceException on the line
How can I fix it?
Code:
var actorSkinBatch = actorConstraints.batches[0];
Hi!

You're not assigning the blueprint to the obiSkinnedCloth, so there's no blueprint in use and hence, no constraints.