Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Particle Grabber Help
#1
Hey there.

I have been playing around with the particle grabber and haven't had any luck trying to do the following:

1. Grab a group of particles instead of just 1. Ideally it would grab the closest one clicked and then a few surrounding particles. I tried a few different things, but had no luck.

2. On release the particles snap up sharply. I tried playing with the inverse mass, but haven't had a lot of luck there either. What I would like to happen is for the particles to gently fall in place when the particle is released.

Thank you
Reply
#2
(04-09-2019, 05:48 PM)neecko Wrote: Hey there.

I have been playing around with the particle grabber and haven't had any luck trying to do the following:

1. Grab a group of particles instead of just 1. Ideally it would grab the closest one clicked and then a few surrounding particles. I tried a few different things, but had no luck.

2. On release the particles snap up sharply. I tried playing with the inverse mass, but haven't had a lot of luck there either. What I would like to happen is for the particles to gently fall in place when the particle is released.

Thank you

Hi there,

I assume you're using the ObiParticlePicker class.

1. Should be pretty straightforward. Once you click and the pick the closest particle to the camera ray, simply add a loop to iterate trough all particles and store the indices of those that are within a certain radius of the picked one. You will then need to modify ParticlePickEventArgs to pass in a list of particles instead of a single one. (For instance, use List<int> instead of int for the indices, same for worldPositions)

2. Mass does not determine how fast particles move, it just doesn't work that way (not in real life, either). You need to apply an external force, or alternatively use damping to make particles lose kinetic energy. Depending on the exact result you're after this can be achieved in multiple ways, however they all involve modifying particle velocities (either directly or trough forces).
Reply
#3
Yeah I did the List earlier, but it spazzes out when I go to move a particle. 

I'll try and play around with the velocity.
Reply
#4
(05-09-2019, 05:41 PM)neecko Wrote: Yeah I did the List earlier, but it spazzes out when I go to move a particle. 

I'll try and play around with the velocity.

Hi,

Can you post the code you tried?
Reply
#5
(06-09-2019, 07:03 AM)josemendez Wrote: Hi,

Can you post the code you tried?

D= I wish i would have seen this earlier. I reverted back so I can get the game working again.

Essentially I updated the eventargs to use a list<int> and I added everything detected in a radius and created for loops to address the dragging. Sorry...

Could you still help me out?
Reply
#6
(06-09-2019, 06:25 PM)neecko Wrote: D= I wish i would have seen this earlier. I reverted back so I can get the game working again.

Essentially I updated the eventargs to use a list<int> and I added everything detected in a radius and created for loops to address the dragging. Sorry...

Could you still help me out?

Yep, of course, but I'd have to see what you wrote. Your description seems 100% right, but the devil is often in the details.
Reply