Obi Official Forum
Help particle properties at Runtime - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Help particle properties at Runtime (/thread-4140.html)



particle properties at Runtime - Nightfall - 26-03-2024

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]


RE: particle properties at Runtime - josemendez - 26-03-2024

(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/manual/6.3/scriptingconstraints.html


RE: particle properties at Runtime - Nightfall - 28-03-2024

(26-03-2024, 08:34 AM)josemendez Wrote: Hi!

See: http://obi.virtualmethodstudio.com/manual/6.3/scriptingconstraints.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];



RE: particle properties at Runtime - josemendez - 28-03-2024

Hi!

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