Trying to check if there is a point ahead...

Discussions about SOFTIMAGEs© Interactive Creative Environment©
User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Trying to check if there is a point ahead...

Post by Pete » 10 Jul 2013, 11:53

Hi there,

I'm trying to get a group of particles to check if there are any particles in front of them and I'm struggling to figure out how I could get this working.
The closest I can figure is "Get Nearest Points" but I only want to check if there are points in a certain direction.
Also Raycast wont work as it's looking for geometry.

Image

Any ideas where i could start with this??
Thanks
Pete

User avatar
nixx
Posts: 42
Joined: 09 Jun 2009, 18:25

Re: Trying to check if there is a point ahead...

Post by nixx » 10 Jul 2013, 12:35

Pete wrote:Hi there,

I'm trying to get a group of particles to check if there are any particles in front of them and I'm struggling to figure out how I could get this working.
The closest I can figure is "Get Nearest Points" but I only want to check if there are points in a certain direction.
Also Raycast wont work as it's looking for geometry.

Any ideas where i could start with this??
Thanks
Pete
Get neighboring particles, get their pointpositions, draw vectors from the current particle's position to the neighbors' positions, and check the angle between those vectors and the current particle's velocity vector. The neighbors that return 0 are directly in front of the current particle (or you can check if the angle<=x, where x is the angle of a "cone", in case you want a broader search area).

I believe it can be refined further, but that should be a good start.
I 'm child, and man, and child again; the boy never gets older.

my Vimeo

User avatar
Tekano
Posts: 488
Joined: 09 Jun 2009, 12:49
Location: London, UK

Re: Trying to check if there is a point ahead...

Post by Tekano » 10 Jul 2013, 13:29

take a look at 'get neighboring particles' node inside it demonstrates how to filter by cone angle along the velocity vector - essentially what you are asking
Gossip is what no one claims to like, but everybody enjoys.

User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Re: Trying to check if there is a point ahead...

Post by Pete » 12 Jul 2013, 01:59

Thanks guys,
That's just what I was looking for. I opened up the neighbour node and messed around with it a bit.
This was a bit scary to see -
Image
Glad they had already gone through the pain for me :)