Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  particle properties at Runtime
#1
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?

   
Reply
#2
(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
Reply
#3
(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];
Reply
#4
Hi!

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