Forum

CreateBody

Hello,

is there a way to change the size of a Box, after it was created with the node CreateBody.

For example, when the key “A” is pressed, a box is created, and the box grows as long as the key is pressed.

I use the GetBodyDetails help node,
there I created an ScaleShape Node and connected it with the GetBodyDetails Node (with the Shapes output pin).

I created an IOBox with 100 rows. First value ist 0,01, the others are 0.
Then i connected the IOBox with the Factor pin of the ScaleShape Node.
So I can increase the size of the newest box.

so, with ScaleShape you can change the size, but both axis will be affected…,.,.but is there a way, how i can just increase one axis. For example the X-axis so it just gets longer?

Please, has anyone an idea or advice?

Hello,

ScaleShape only works with one axis. Did it this way because it works independently on box/circles.

You can try with Using CreateShape/DestroyShape tho (which is what scaleshape does internally as box2d is for rigid bodies).

If you need more help let me know.

hey vux,
thank you for the answer. I made a patch to show what i try to do.
Would be perfect, if it just grows on one axis.
In the actual patch I use gravity and stuff, so i need box2d.

How can I do it with CreateShape/DestroyShape?

I opend v4 the first time a view weeks ago, so i have got many questions and the patch I wrote looks like a workaround, but i’m impressed, how good things work, especially box2d is awesome ;-)

mosaic.v4p (13.2 kB)

ok, I found a way how to use Create/DestroyShape to change the x-Axis of an box. I added an X and Y input pin at the CreateBoxe Node, there I added a timewatch which gets enabled if a key is pressed. At the same time, CreateShape and DestroyShape gets enabled.

So i got a growing box, when a key is pressed.

But the problem is, I want the last boxes to stay, but everytime a new key is pressed, the old box gets destroyed by DestroyShape, how can I prevent the last box getting deleted?

the main patch where I want to create many boxes of diffenrent length (15.0 kB)
I added an Xsize and Ysize Input pin (9.4 kB)

anyone an idea?

push ^^

as hint:

<NODE componentmode="InAWindow" id="17" nodename="C:\Users\turni\v4\vvvv_40beta23\plugins\CreateBoxes2.v4p" path="C:\Users\turni\v4\vvvv_40beta23\plugins\">

is an absolute path, means: if somebody tries to open your mosaic patch (s)he will miss the subpatch.
read more about paths

thx kalle for the hint.
Does it work now?

Maybe the “paths” link would be usefull, if its shown when you want to upload a file to your post.

Mosaic2.rar (12.8 kB)

The patch still doesnt work! I think u forgot to put the createBoxes subpatch in ;)

haha, thx

now the patch vvvorks, but still the old problem…

Mosaic2.rar (12.7 kB)