i tried to fill box2d bodys with a color. This works fine with a mesh and vertex buffer. But now i wonder how i can give different colors to custom boxes.
In this patch you can create two boxes with diffenrent custom names.
BoxA and BoxB. In the subpatch " farbflaecheCalc " the mesh and the color is defined.
Is it possible, that all BoxA Bodys get one color, and all BoxB Bodys another?
Hi
now you got mr hooked on this. I am trying to do it with a Polygon but I find it a bit tricky withe the spreads. My idea is to create the triangles forming the mesh taking 2 consequential vertices then the center of the shape, so I need a way to “nest” together 2 different spreads…
Something like: take a bin of 6 from the vertex buffer, then insert the center, take another 6 and add center again and so on…
as you create a mesh inside the “flaechenfarbeCalc” you just leave the vertices white and replace the DrawFixed with any shader you want to draw your mesh… if its just a color you need then use Constant, but you can use any shading you want…
i’m testing the CarPaint-Shader in combination with this patch. How can I change the lightsetting. At the moment, the light comes from 0/0 and has the direction to -1/-1, so everything above is not visible. how can i define a radial gradient starting from 0/0?
Probably the best solution at the moment for meshing polygons is vux’s ‘Polygon (EX9 Geometry 2d)’ node, it’s in the addonpack. If you just take the ‘vertices xy’ and ‘vertices count’ from the box2d getpolygons node and send them to the polygon mesh node, you will get the mesh you need.
The problem becomes a little more complex when you want to make a mesh that is ‘concave’ as opposed to ‘convex’. Info on convex shapes here:
At the moment there’s only a few good ways to make meshes from ‘concave’ shapes, and unfortunately there’s no plugins for this in vvvv yet.
Regarding the carpaint shader issues, it might be best to start a new thread with some questions about shaders/lighting?
Hi
thanks, I even had it installed but forgot about it!
At this point the “concave” issue is not really important since Box2d can t handle concave shapes either.
I have never tried but we should be able to obtain concave shapes adding 2 or more non-concave shapes together and calculating the proper rotation center for each object…