SOLVED How to represent an empty physic box?

elsen

Member
Hi there,
It's been a while my Game Maker skills are rusty (joining from game maker v6 ;))

I'm using the default physic engine to create, move, and collides my objects,

I would like to create a box that is empty
so that something inside this box could interact with it using physics.
What's the best way to represent that box?

Ideally, I'd create a polygon, that can be "styled" with sprites and that could rely on the default physic engine,
but I don't know how to get started, nor if it's even possible.
 

Bart

WiseBart
Hello.

If I understand the question correctly you want to create a box that isn't solid and has just edges. To define such a shape you can either bind multiple edge fixtures or a single chain fixture to an object or instance.
I personally find a chain fixture to be the easiest, since you only need to define the common fixture properties once. All corner points can then be defined with a call to physics_fixture_add_point, though that's not even required for the last one if you set the chain fixture to be closed (if you don't make it closed the box will stay open on that side).

Edge and chain fixtures will have to be created and bound to an object or instance through code though, since GM's built-in physics editor is a bit limited in which shapes you can define (only solid ones, a single fixture per object/instance that you cannot reference through code, ...)

Hope this can help a bit to get started :)
 
Top