Give Physics properties to a shape painter object

Hi, I’m trying to make a game inspired by the vector graphics of Asteroid. I’m using shapes and events to define how Gdevelop should draw what the user will see. I haven’t clear some things though.

I’m trying to design the playable characters in this way:

  • Each character has some states, and each state has a different shape.
  • Each character can collide with static and dynamic objects (with other players too), and the collisions must have physics (with Physics 2.0 or alternative).
  • Each character has to have the vector aesthetics (I can use hidden sprites, even if I’d like to avoid it).

The desired result is a body that can move, rotate, collide (with accurate edges), bounce and do physics things, and also morph between states.

Is there a way to add Physics to the shape itself, possibly with the automatic accurate generation of its collision mask?

This would solve all of my problems.

If not how can I work around this?

You don’t want to give Physics to the shape painter but to the shapes, but the shapes aren’t objects, so you cannot.
You can draw your characters as you like in vector software like Krita or Inkscape, and then import those files as sprites in GDevelop.

Thanks for the suggestion, but then I wouldn’t be able to control the thickness of the outline, nor to have a morphing effect between two shapes.

My fallback solution is to have a hidden sprite object for the physics, with the shape painter object that is drawn on top, but I haven’t found a way to rotate the shape. Is it possible?

EDIT: the solution is the event Change the angle of [shape]: set to [sprite].Angle()

1 Like

I saw this video from the Gem Dev about the extension “Sprite Snapshot” (Info: Renders an object, layer, scene or an area of a scene and puts the resulting image into a sprite.).

It renders shape painter based sprite-objects. I think this could do the trick for you and give the rendered shape a physic behavior and move, rotate, collide, bounce it and do physics things as wished. For the second wish (having an automatic set up accurate physic-collison-mask) I dont get a solution by just thinking about it. The standard made physic-collision mask is squared as the the spriteobject or can be changed (i think so, not sure) to circle via condition. But to have it with multiple vertecies matching your specific shape painter based sprite would mean…it needs a condition based method to a) read your shape painter based vertecies b) maybe save the to some variables and c) translate them to physic-collision-mask-vertecies… I dont know if thats possible with conditions. As far as I know you can only set them up manually within the physic behavior tab.

Maybe these thoughts will be helpful.