Posts: 11
Threads: 3
Joined: Sep 2018
Reputation:
0
Also:
- Uninstantiating particles within the radius of a Vector3 location
And / or:
- Changing values of an Emitter Material at runtime, such as Resolution or Rest Density
So, given an arbitrary Vector3 world location, will it be easy to determine if that location is within the volume of a collection of Obi Fluid particles? The Obi Fluid will be at rest in a container when I need to do this, so it wont be run while fluid is flying around the scene or anything. I've not had the chance to properly trawl through the API documentation yet, so my apologies if there's an easy answer in there.
The two next questions are pretty much as written; is there an easy way to uninstantiate particular particles? Again, apologies if this is obvious in the API docs!
And is it advisable / possible to alter the properties of Emitter Materials at runtime?
Thank you!
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
16-10-2018, 07:50 AM
(This post was last modified: 16-10-2018, 07:52 AM by josemendez.)
(15-10-2018, 05:17 PM)Mitch@PG Wrote: Also:
- Uninstantiating particles within the radius of a Vector3 location
And / or:
- Changing values of an Emitter Material at runtime, such as Resolution or Rest Density
So, given an arbitrary Vector3 world location, will it be easy to determine if that location is within the volume of a collection of Obi Fluid particles? The Obi Fluid will be at rest in a container when I need to do this, so it wont be run while fluid is flying around the scene or anything. I've not had the chance to properly trawl through the API documentation yet, so my apologies if there's an easy answer in there.
The two next questions are pretty much as written; is there an easy way to uninstantiate particular particles? Again, apologies if this is obvious in the API docs!
And is it advisable / possible to alter the properties of Emitter Materials at runtime?
Thank you!
Hi there,
- Uninstantiating particles within the radius of a Vector3 location:
There's two options: iterate over all particles checking if they're within range of the Vector3 point (which if done every frame, can be inefficient) or use a spherical trigger collider and consider particles inside it (a better option). Then just set their life to zero. There's an example that does exactly this here:
http://obi.virtualmethodstudio.com/tutor...sions.html
- Changing values of an Emitter Material at runtime, such as Resolution or Rest Density
Yes, simply assign whatever values you need to the material properties, then call:
Code: material.CommitChanges(ObiEmitterMaterial.MaterialChanges.PER_MATERIAL_DATA | ObiEmitterMaterial.MaterialChanges.PER_PARTICLE_DATA);
Posts: 11
Threads: 3
Joined: Sep 2018
Reputation:
0
(16-10-2018, 07:50 AM)josemendez Wrote: Hi there,
[snip]
That's fantastic, thank you, exactly what I need to proceed.
Any thoughts on detecting if an arbitrary point is "within" an Obi Fluid volume?
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
17-10-2018, 08:28 AM
(This post was last modified: 17-10-2018, 08:28 AM by josemendez.)
(16-10-2018, 04:31 PM)Mitch@PG Wrote: That's fantastic, thank you, exactly what I need to proceed.
Any thoughts on detecting if an arbitrary point is "within" an Obi Fluid volume?
Hi,
Fluid is discretized as particles, so checking if a point is "within the volume" is equivalent to checking if it is close enough to any particle. Using a small spherical trigger would do the trick, just like in the "Uninstantiating particles within the radius of a Vector3 location" case. Just make sure the collider is roughly the same radius as a particle.
Posts: 11
Threads: 3
Joined: Sep 2018
Reputation:
0
(17-10-2018, 08:28 AM)josemendez Wrote: Hi,
Fluid is discretized as particles, so checking if a point is "within the volume" is equivalent to checking if it is close enough to any particle. Using a small spherical trigger would do the trick, just like in the "Uninstantiating particles within the radius of a Vector3 location" case. Just make sure the collider is roughly the same radius as a particle.
That's great, thank you; I'll have to have a think about efficiency and the best way to put the pieces of this together, but that gives me everything I need so far.
Posts: 11
Threads: 3
Joined: Sep 2018
Reputation:
0
31-10-2018, 03:34 PM
(This post was last modified: 31-10-2018, 03:34 PM by Mitch@PG.)
(16-10-2018, 07:50 AM)josemendez Wrote: [...] use a spherical trigger collider and consider particles inside it (a better option)
So ... uh, how do I set up a trigger collider? If I add an Obi Collider, the particles bounce off it, which I don't want; I tried setting the Thickness to -1.0, but this crashed Unity.
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
(31-10-2018, 03:34 PM)Mitch@PG Wrote: So ... uh, how do I set up a trigger collider? If I add an Obi Collider, the particles bounce off it, which I don't want; I tried setting the Thickness to -1.0, but this crashed Unity.
Enable the "is trigger" checkbox in the collider itself (not the ObiCollider).
Posts: 11
Threads: 3
Joined: Sep 2018
Reputation:
0
(31-10-2018, 04:38 PM)josemendez Wrote: Enable the "is trigger" checkbox in the collider itself (not the ObiCollider).
... the standard collider component properties affect the Obi component behaviour??
Posts: 6,322
Threads: 24
Joined: Jun 2017
Reputation:
400
Obi Owner:
01-11-2018, 06:21 PM
(This post was last modified: 01-11-2018, 06:27 PM by josemendez.)
(31-10-2018, 05:41 PM)Mitch@PG Wrote: ... the standard collider component properties affect the Obi component behaviour??
Of course. The ObiCollider component simply tags the collider so that Obi particles become "aware" of it, and adds a couple properties that are only relevant for Obi (phase and thickness). However it does pretty much nothing by itself, it needs the presence of an actual collider.
The collider component itself is used for collision detection, and all its properties will work as usual (type of collider, size, shape, is trigger, etc). Same for rigidbodies. See:
http://obi.virtualmethodstudio.com/tutor...sions.html
|