Running into issues trying to get physical objects working for my platformer. I use a tilemap / tileset created from Tiled, with the Tilemap and Tilemap Collision Mask objects.
I want to add some physical items that drop from the boxes when they’re bumped. I added the Physics Engine 2.0 behavior to the item setting it to Dynamic type: By default it falls through the ground, although I expected it would automatically detect Platform objects and collide with them. Seeing it doesn’t do so I also added the Physics 2 behavior to the tilemap collision object obviously as a Static type; This time the item immediately disappears the first frame after being spawned, as if it’s colliding with the entire rectangle of the tilemap and getting thrown out of bounds.
Is it possible to make the physical item automatically detect objects with the Platform behavior as colliders, same way a Platformer Object will? If I also need the Physics behavior on the tilemap itself, how do I configure it so it collides properly and only solid tiles interact with items?
IDK if the “tilemap collision object” works well with the physics behavior. Anyway, the physics behavior has it’s own collision mask. It’s in the middle in the pics you posted. FYI: It also uses it’s own collision conditions as well.
I tried enabling all Layers and Masks on the item’s Physics 2 behavior, but it still won’t collide with any Platformer Object items on its own. I wonder what the Platformer Object uses for physics and if I could replicate it in my own behavior, it’s a builtin extension so I can’t open it in the editor to look.
In the meantime at least I have a workaround: I’m just going to give items the Platformer Object behavior too and simulate pressed keys to do my own simple physics. In fact I can just give them that behavior for character physics and only apply forces in my own behavior, same effect either way.
Yeah, both objects would need the physics behavior. Mixing behaviors can cause conficts as each one wants to do its own thing.
Probably not what’s happening here: Willing to bet the tilemap collision object doesn’t support setting up for Pysics 2.0 yet, it sets up collisions for the whole rectangle rather than individual tiles. Even if I remove Platformer / Platformer Object from both the tilemap collision and item objects, replacing them with Physics 2 behaviors, the exact same result occurs.
I’m now using this hack as a workaround. Will try to replace pressed keys with just forces, it feels wrong to treat an item as a character and simulate key pressed on it. But I’ll need the Platformer Object behavior on items to simulate my own physics, unless there’s a simpler way to get just the gravity from that behavior? Simulating movement keys may still come in handy for slippery items, like how mushrooms in Mario glide along the floor once spawned.
Much simpler method, works even better and offers more realistic results. Essentially apply a constant force upward or in the left or right direction, decrease that force slowly over time until gravity overwhelms it… this will cause the item to jump and bounce around as desired. Till a solution for this limitation is found it’s likely what I will be sticking with.
Sorry, missed these updates.
The physics collision logic are from Box2D and completely incompatible with any other movement logic.
The tilemap collision object is creating standard collision masks, and therefor has no interactions with the physics engine. Since they don’t have a normal object (they are just a mask) they would not have a way to have physics collisions, and it would just treat it as the full AABB box of the object.
Thanks for confirming. I presume there’s no way to extract only the gravity and collision component from the Platformer Behavior object, so I can have just that without anything else? If not I’ll leave my items with its behavior and use it to simulate physics.
Not without directly creating your own behavior via code, as far as I know.