Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How move selected particle in actor from script
#1
Hi!
Please tell me how move selected particle in actor from script.

The general task is: after touching, i find the particle that was touched and move it with my finger. as a result, the liquid should follow the finger. All process in 2D space.

Thanks.
Reply
#2
(13-01-2025, 08:41 AM)Zavhoz Wrote: Hi!
Please tell me how move selected particle in actor from script.

The general task is: after touching, i find the particle that was touched and move it with my finger. as a result, the liquid should follow the finger. All process in 2D space.

Thanks.

Hi,

You can both read and write any particle properties (positions, velocities, etc) using the particles API. See the manual, it explains how to use it together with code examples:
http://obi.virtualmethodstudio.com/manua...icles.html

Note that directly setting particle properties isn't the only way to achieve what you want. You could also use either colliders or force zones.

kind regards,
Reply
#3
(13-01-2025, 09:02 AM)josemendez Wrote: Hi,

You can both read and write any particle properties (positions, velocities, etc) using the particles API. See the manual, it explains how to use it together with code examples:
http://obi.virtualmethodstudio.com/manua...icles.html

Note that directly setting particle properties isn't the only way to achieve what you want. You could also use either colliders or force zones.

kind regards,
Thanks for the quick reply.
- in my case, a 2D solution without gravity, so it is not suitable for the force zone, since it only works with 3D colliders.
- a collider with the Inverted parameter absorbs all particles, tearing them away from the main mass of the emitter. as a result, the stretching effect does not work.
- from the code, the particle also breaks away from the main mass of particles.

I want to get the effect as in the picture:
   
Reply
#4
(13-01-2025, 01:09 PM)Zavhoz Wrote: Thanks for the quick reply.
- in my case, a 2D solution without gravity, so it is not suitable for the force zone, since it only works with 3D colliders.

In Unity you can add 3D colliders to a 2D scene and vice-versa. You can use a force zone just fine, since the ObiSolver is in 2D mode particles will only move in 2D.

(13-01-2025, 01:09 PM)Zavhoz Wrote: - a collider with the Inverted parameter absorbs all particles, tearing them away from the main mass of the emitter. as a result, the stretching effect does not work.

You don't want to use an inverted collider for this. In any case,  a regular collider that pushes particles around (depending on the effect you're after).

(13-01-2025, 01:09 PM)Zavhoz Wrote: - from the code, the particle also breaks away from the main mass of particles.

This will only happen if you explicitly set a position for the particle(s). What you want to do is add a force towards the user's cursor/finger location instead. The intensity of the force must be proportional to the particle's current distance from the cursor/finger.

kind regards,
Reply