ICE polygon Magnet

Discussions about SOFTIMAGEs© Interactive Creative Environment©
User avatar
Maximus
Posts: 1121
Joined: 09 Jun 2009, 13:45

ICE polygon Magnet

Post by Maximus » 28 Jul 2011, 14:13

Hello guys, i'm tryin to build a rather complex thing for my skills i guess :D

What i want to do is have a geometry with disconnected polygons (select all faces -> disconnect components) then i want a Null to influence those polygons individually, attracting them to the null itself like a magnet, in this way i could "break" an objects when the null passes by.

I am having some problems to figure it out how to achieve this thing, i've found that the "Set Data" doesnt accept PolygonPosition, it gives me an error "PolygonPosition is read-only" data.

What i did so far is calculating the distance between the null and the object position, and IF it is lower than a certain number then i would like to "Set the new polygon position".

Am i failing in the path i took to create this?


Thanks for help!

Max

User avatar
Maximus
Posts: 1121
Joined: 09 Jun 2009, 13:45

Re: ICE polygon Magnet

Post by Maximus » 28 Jul 2011, 14:16

the effect i would like to achieve is similar to this one, but controlled with a null

http://vimeo.com/groups/1693/videos/15146162

grahamef
Posts: 281
Joined: 23 Jun 2009, 19:01

Re: ICE polygon Magnet

Post by grahamef » 28 Jul 2011, 15:52

You will need to transform the polygons' vertices instead. You can get the indices of the vertices by getting the PolygonToVertices attribute.

User avatar
Maximus
Posts: 1121
Joined: 09 Jun 2009, 13:45

Re: ICE polygon Magnet

Post by Maximus » 28 Jul 2011, 16:33

thanks for the tip, but that would do for the "Get data" as polygon to vertices, but i cant write this attribute, i mean i cant set that data i can only get the PolygonToVertices, how can i set PolygonToVertices? There isnt any attribute of that kind in the geometry set, or i'm missing something!

Max

User avatar
origin
Posts: 619
Joined: 09 Jun 2009, 09:59
Location: warsaw

Re: ICE polygon Magnet

Post by origin » 28 Jul 2011, 18:42

polygontovertices will give you indicies of vertices per poly. To move polygon, you need to move points that belongs to that polygon (that is you can only set data to pointposition). Polygonposition is averange vector of all vertices' positions

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 16:43

Re: ICE polygon Magnet

Post by Chris_TC » 28 Jul 2011, 19:15

You will probably have to do a few context conversions. You'd start off by checking the distance from the null to the polygonposition. Now let's assume that polygons 19 and 23 are close enough to the null so that they should be influenced.

You now have to move all the points that make up these polygons. When you do a .PolygonToVertices, every polygon will return its vertices, that's no good. So you have to filter. If you do a Find In Array, you can specify <<19, 23>> as the array, and self.PolygonIndex as the value to find. The result of <<Found>> plugs into a <<Filter>> and thus filters the .PolygonToVertices.

The output pipe of the <<Filter>> will now only let the vertices of polygons 19 and 23 pass. Before setting the point position, you'll have to do something similar. You don't want to set all the point positions, only the ones that have been filtered.

Since polygons 19 and 23 may have to experience different forces, you may also want to check which polygon each point belongs to. I think the attribute is called .VertexToPolygons. This will be an array with only one entry in your case. So if you select index 0, you can differentiate which polygon each vertex belongs to. This then allows you to affect the vertices of polygon 19 differently than the vertices of polygon 23.

I haven't tried anything of this in Soft, so there may be a few errors in my thought process.

grahamef
Posts: 281
Joined: 23 Jun 2009, 19:01

Re: ICE polygon Magnet

Post by grahamef » 28 Jul 2011, 19:19

Once you have the filtered set of PolygonToVertices, you can plug that into Build Array from Set to concatenate all the arrays together into one object-context array. Now you can get VertexIndex and use Find in Array to filter the PointPositions to set.

There are other ways of doing this too. I don't recall the exact method that Guillaume Laforge used here http://frenchdog.wordpress.com/2010/03/ ... using-ice/ but it was before PolygonToVertices was available. You can download his add-on if you want to try it out.

User avatar
Maximus
Posts: 1121
Joined: 09 Jun 2009, 13:45

Re: ICE polygon Magnet

Post by Maximus » 28 Jul 2011, 22:30

uhm thanks guys for support, i'm going to wrap my head around this but so far i cant really make it work i guess its a bit too complicated for me, i'll try anyway.

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 16:43

Re: ICE polygon Magnet

Post by Chris_TC » 28 Jul 2011, 23:17

Hi Max,

I hope this helps getting you started. ICE Tree and compound below.
Make sure to understand what's going on in this and how switching context works. Hover over the connections to keep track of the context (this is important to understand the tree). Use a temporary Set Data to visualize values at different steps of this tree. And if you have any questions, feel free to ask.

Image
You do not have the required permissions to view the files attached to this post.

User avatar
Maximus
Posts: 1121
Joined: 09 Jun 2009, 13:45

Re: ICE polygon Magnet

Post by Maximus » 29 Jul 2011, 00:37

ugh thanks a lot Chris :D
after i checked your tree, i failed on building the array from set, after the first "lower than" node, and also i didnt use the "true" in find in array, so stuff didnt connect together :/
need more practice, i'll try to add some forces to have them spin around after they breaks.

thanks a lot everyone for help, and thanks Chris!

User avatar
TwinSnakes007
Posts: 316
Joined: 06 Jun 2011, 14:00

Re: ICE polygon Magnet

Post by TwinSnakes007 » 29 Jul 2011, 01:26

If you have SI2012, then that's as simple as pie. This "type" of effect was the first thing I tried when I started learning ICE. This tree moves each polygon along it's normal. It can easily be adjusted to achieve the effect you're looking for.

Image

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 16:43

Re: ICE polygon Magnet

Post by Chris_TC » 29 Jul 2011, 08:57

It works this easily because you're not limiting the effect to a null's distance to the polygon centers, so you can use point context straight away without any conversions.

User avatar
Rork
Posts: 1359
Joined: 09 Jul 2009, 06:59
Location: Close to The Hague, Netherlands

Re: ICE polygon Magnet

Post by Rork » 29 Jul 2011, 14:18

Nice one to add to this: animated geometry ;-)
SI UI tutorials: Toolbar http://goo.gl/iYOL0l | Custom Layout http://goo.gl/6iP5xQ | RenderManager View http://goo.gl/b4ZkjQ
So long, and thanks for all the Fish!!