Tagging points from another cloud from a geometry query

Discussions about SOFTIMAGEs© Interactive Creative Environment©
Post Reply
User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Tagging points from another cloud from a geometry query

Post by claudevervoort » 21 Jan 2010, 23:03

Hi!

I'm experimenting with ICE trying to do a little cat and mouse games with particles. Cats hunt and eat mice, mice flee the cats.

Now one cat particle cannot eat more than one mouse in a given time so not all mice in vicinity of a cat will die.

So I have 2 point clouds: the cats, the mice. Naively I initially thought that, while running the cats Ice tree, each cat would look around for mice to eat using a get closest points from the mice pointcloud and either kill them or at least set a property 'eaten' on them so that when the Mice tree get evaluated, a mouse with that attribute set would 'die'.

Now, bummer, in the doc it clearly say that one cannot modify information gotten from the get Closest Point. It proposes to reverse the query: each mouse would then look for a cat around, and if so kill itself. Well that does not work for a few reasons: a single cat could kill many mice in one go, and a cat would not know it has eaten a mouse and so cannot alter its state accordingly.

Possibly this is not meant to be done with ICE and I should look at a scripting solution. I'd just want to know if I am not missing something (and I am missing a few things when it comes to ICE :) ).

Thanks for any idea!

Claude

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Re: Tagging points from another cloud from a geometry query

Post by claudevervoort » 22 Jan 2010, 02:52

Well I did find a workaround, not as elegant since it requires 2 get closest points queries:

the CAT particle adds a new dynamic attribute: ID of the Mouse it intends to eat

the MOUSE queries the CATs around and see if one carries its own id, and if so kills itself.

Finding that solution was a cat and mouse in itself :)

Claude

User avatar
owei
Administrator
Posts: 840
Joined: 03 Jun 2009, 17:25
Location: Siegen/Germany
Contact:

Re: Tagging points from another cloud from a geometry query

Post by owei » 22 Jan 2010, 08:47

Hi CLaude..!

That would have been the way in my eyes. Well, it´s elegant, I think. Mostly you can solve those problems by adding ID arrays to certain particles and query them from other points or pointclouds. I´m doing somekind of goal search right now and it runs into almost similar problems...

Thanks for posting your solution by the way..!

cheers,
oliver

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Re: Tagging points from another cloud from a geometry query

Post by claudevervoort » 22 Jan 2010, 15:09

Thanks Oliver! Glad to see i'm on the right track :)

Claude

Zarvosa
Posts: 13
Joined: 19 Aug 2009, 23:13
Location: Vancouver, Canada

Re: Tagging points from another cloud from a geometry query

Post by Zarvosa » 20 Feb 2010, 05:01

I read this and thought it was a cool idea so I challenged myself to make up a scene that does the same thing differently. It worked too, well enough.
pictures are big so I'll just link them though, instead of embedding.
Instead of using closest point queries, I used statistics. Assuming there is only one cat, you can get the position of the one cat in the mouse ice tree:
Get Data(cloud_cat.pointposition)->Get Set Sum
On each mouse I set an integer self.mystate as 0, 1, or 2 with 0 being roaming, 1 being chased (1 being the single closest mouse to the cat), and 2 being dead.
On the Cat tree, I filtered the mouse point positions to include only the mice with a mystate of 1, and got the sum (one value only, so the sum IS the value) then told the cat to move towards that point.
Cat Tree
Mouse Tree
resulting scene

User avatar
owei
Administrator
Posts: 840
Joined: 03 Jun 2009, 17:25
Location: Siegen/Germany
Contact:

Re: Tagging points from another cloud from a geometry query

Post by owei » 20 Feb 2010, 10:12

Nice approach Zarvosa!
I´ll check this out as soon as I got my hole setup done. Currently I´m doing a "virtual restaurant" in ICE...which was/is quite challenging because one is running in those context issues and setting correct data for the correct particle every second ;)

cheers,
oliver

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Re: Tagging points from another cloud from a geometry query

Post by claudevervoort » 20 Feb 2010, 16:26

Thanks Zarvosa for sharing your approach! I'm not sure if it plays in with what I am doing, since in my case it's multiple birds chasing flies, so various flies need to flee from different birds. Still using get minimum in set is interesting, I'll think about it for sure. And I've already seen a couple of things I should have used (like using point force rather than manually substracting 2 position vectors x_x ).

Claude

Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests