Obi Official Forum
Selecting the particles inside of a sphere. - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Selecting the particles inside of a sphere. (/thread-4353.html)



Selecting the particles inside of a sphere. - SuikaSukiyo - 02-09-2024

What is an easy way to select the particles in the center of a sphere when creating a particle group?

There is the method of removing layers by optimizing but is there a better way? 
Something like being able to specify a position to expand a selection from.

If I am missing some major tools for the particle group selector, I would greatly appreciate any directions.


RE: Selecting the particles inside of a sphere. - josemendez - 02-09-2024

Hi,

There's no tool that would allow you to select all particles in the center of a sphere, that's very specific. What's your use case? Maybe it would be simpler/easier to create the particle group at runtime, given any specific condition you want the particles in the group to meet?

kind regards


RE: Selecting the particles inside of a sphere. - SuikaSukiyo - 03-09-2024

(02-09-2024, 03:43 PM)josemendez Wrote: Hi,

There's no tool that would allow you to select all particles in the center of a sphere, that's very specific. What's your use case? Maybe it would be simpler/easier to create the particle group at runtime, given any specific condition you want the particles in the group to meet?

kind regards

Thank you for the quick reply. 
I was trying to make a ball with a relatively hard core compared to its exterior as an experiment to learn the tool.
The eventual use would be to select particles relative to a bone and surface position in order to easily edit different groups. 
The FBVS already exists for this purpose but I haven't tried it yet. 
Could you please point me toward how to interact with the particles within a BP in code? 
And a method to interact with the blueprint editor window?

[A Suggestion for the BP Editor]
I think it would be very useful to have primitives that act as selectors. 
For my exact case, a sphere that can be centered and then used to select a group of particles.
This could also be extremely useful for complex skeletal particle groups such as using a capsule to select bicep muscles or other shaped grouped.


RE: Selecting the particles inside of a sphere. - josemendez - 04-09-2024

(03-09-2024, 02:30 PM)SuikaSukiyo Wrote: Could you please point me toward how to interact with the particles within a BP in code? 

Hi!

Yes, blueprints have lists of per-particle properties: positions, principalRadii, colors, etc. All arrays have the same length and each entry contains data for one particle. Particles from 0 to activeParticleCount are active, and the total amount of particles is particleCount. This is all very similar to how you usually deal with particles in a solver. Search for ObiActorBlueprint in the API docs.

(03-09-2024, 02:30 PM)SuikaSukiyo Wrote: And a method to interact with the blueprint editor window?

ObiSoftbodySurfaceBlueprintEditor.cs contains the code for the softbody blueprint editor window. You could modify/extend it if you want, though the code is not commented sufficiently well to be modified by external users.

In its OnEnable method you'll see it adds three tools to itself: ObiParticleSelectionEditorTool, ObiPaintBrushEditorTool and ObiPropertyTextureEditorTool. These are the tools/tabs used to select particles, paint per-particle properties and import/export particle data from/to textures.

The first two tools use a brush to allow the user to interact with particles: ObiParticleSelectionEditorTool uses ObiScreenSpaceBrush to select particles by clicking/dragging on the screen, selecting those inside a circle. ObiPaintBrushEditorTool uses ObiRaycastBrush, which is a 3D brush that raycasts against the mesh and selects particles within a 3D radius of the raycast hit: this might be a good starting place to create tools like the one you describe. For instance instead of raycasting against the mesh, you could allow the user to explicitly move the center of the selection sphere using a position handle.

let me know if you need further help.

(03-09-2024, 02:30 PM)SuikaSukiyo Wrote: [A Suggestion for the BP Editor]
I think it would be very useful to have primitives that act as selectors. 
For my exact case, a sphere that can be centered and then used to select a group of particles.
This could also be extremely useful for complex skeletal particle groups such as using a capsule to select bicep muscles or other shaped grouped.

We'll consider adding this functionality in the future, thanks for the suggestion!

kind regards