Legacy GM [HELP] How to draw line on mouse move that have a physics



Hi everyone , for past two days i was searching about this thing and i find nothing :(

( WHAT I NEED IS to draw a physics line by mouse to walk on it by my player )

for example the RED LINE in this image


please can you help me guys
Last edited by a moderator:
I don't know if you want the line to be solid while you are drawing it, or only when you are finished drawing it. In the second case, the solution would be simpler because you wonldn't need to be constantly deleting and recreating fixtures.

You are going to need to do a few things.

Record a list of points that represent where the mouse is in each step since the player has started to draw the line. You may want to make it so that a new point isn't added unless the mouse has moved a minimum ditance since the last point was recorded. That will prevent scenarios from uselessly adding tons of points all in the same place.

You will need to draw lines that connect each point to the next point in the list. You can do this with a loop in your draw event.

Then once you want to make the line solid, you'll have to first of all have an instance to bind the fixture to. So if that doesn't already exist you'll need to create one. Then you'll need to create a new chain shape fixutre, add all the points to it from your list, and then bind the fixture to the instance. Don't forget to delete the temporary fixture or you'll get a memory leak. It may become necessary to unbind previously created fixtures in the event that you are reusing a single instance to generate all of the lines. I believe the points are defined in local space, where the instance's x,y position is considered to be position (0,0).


thank you so much i learn a lot from your advice .
i did what you said and it's work but there is a problem

it's fall but not bouncing like a physics object !


it's stays on the edge like that , why is that ?


well not so sure as the manual does not mention this, but in many tests i did some time ago it does not bounce its self and only bounces things that are dropped onto it, so normal physics objects would bounce and react to it like they should but it wont its self, but all other physics based motions work.