I'm creating a custom mech, and have tweaked the collisions and sprite of the standard mech to match what I need. However, I cannot make heads or tails of how exactly the lines of code related to collisions actually works. Up/down collisions work, as do driving the mech forward into a wall. But when I drive backwards, it collides with walls much too early- as if it's leaving a whole mech-sized space between the mech and the wall for flipping's sake. ...Which is the other problem I'm having. When I turn, the mech flips along the axis of the character, not in the center of the sprite. Is there some way for me to make it flip along a certain point? Anyway, here's some pictures of the problem I'm having. Point of collision driving forward: Point of collision driving backward: And here's my current collisions code: Code: "mechCustomMovementParameters" : { "standingPoly" : [ [-3.1, 0.25], [-2, -2.25], [2, -2.25], [3.1, 0.25], [3.1, 0.5], [2, 0.5], [-2, 0.5], [-0.5, 0.5] ], I hope you can help me resolve this problem, it's been bugging me for ages!
Look at the humanmech collision code to figure it out: Code: "standingPoly" : [ [-3.5, -2.0], [-2, -4.5], [2, -4.5], [3.5, -2.0], [3.5, 2], [2, 3], [-2, 3], [-3.5, 2] ] Each pair of numbers in the "standingPoly" vector is a point in 2d space. Here's a quick visualisation: Hopefully that should show you how to adjust those points to make the collision poly fit better.
I had worked that out myself previously, however it would appear that with the default code, the mech keeps the same collision model even when it flips. I realised that the mech flips along its axis based on the sprite position, and adjusted the sprites and collision model appropriately. It works fine now. Did you use a particular program to draw up that visualisation? That could be really useful for me next time I'm editing collisions at 5am and the numbers aren't making and sense. Thanks!
"Here's a quick visualization" -> image is broken For real though, I've been looking for hours for any visualization tool of rectRegion or poly or something that could help show how collisions work visually would help me immensely if anyone knew of one that was still available
My god! I wish I had known this, you are a godsend. This should really be on the wiki..... if it isn't already
also, boxes are color coded. green objects, red blocks, orange entities, etc only problem is debug must be enabled the entire time, or it won't show