Hi,
This is my first real game in LÖVE2D. I am amazed at how far I have gotten. I have been stuck for several days and need help. If I do not express myself clearly, ask for clarification.I will try to improve. English is not my mother tongue.
The game loads a map made with Tiled and uses STI with Box2D. The tiles, objects (the rocks), and player (bulldozer) all display correctly. The sketchy library displays the collision "boxes". There are two problems.
1) All the collision boxes for the rocks are all in the centre of the window.
2) The bulldozer collision box is offset by half a window.
The bulldozer moves as it should and its collision box moves with it (maintaining a fixed offset). The collision boxes collide properly - rock and bulldozer.
I have been searching with Google, reading forum posts, and looking at example code. I am missing something.
I tried adding an offset to the bulldozer rectangle by calling love.physics.newRectangleShape with dozer.x, dozer.y, dozer.width, dozer.height, and point-right (angle). It generated an "interesting" error: "Box2D assertion failed: m_I > 0.0f". I went back to the simple newRectangle call.
Here is a screen capture image taken after moving the bulldozer.
Any help is appreciated.
Thank you.
STI & physics - body & shape offset
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: STI & physics - body & shape offset
Please attach as minimal as possible game version with this bug. Less code makes the bugfixing much faster.
Re: STI & physics - body & shape offset
I've now downloaded your .love file and checked. This, and your other thread, is something you should probably ask the creators of STI, here: https://love2d.org/forums/viewtopic.php?f=5&t=76983 because it seems to be related to using STI itself.
For example, I replaced your STI version with the latest one from GitHub, and that caused a different result. The lines are rock-shaped and get distributed along the left side of the screen.
I suspect it has to do with your physics shape problems.
Edit: Oops, meant to post this in the other thread.
For example, I replaced your STI version with the latest one from GitHub, and that caused a different result. The lines are rock-shaped and get distributed along the left side of the screen.
I suspect it has to do with your physics shape problems.
Edit: Oops, meant to post this in the other thread.
Re: STI & physics - body & shape offset
Excellent! Using the current STI master changes the behaviour. I will pursue this over at STI. Thank you.
Who is online
Users browsing this forum: No registered users and 5 guests