Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting the particles inside of a sphere.
#4
(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
Reply


Messages In This Thread
RE: Selecting the particles inside of a sphere. - by josemendez - 04-09-2024, 07:27 PM