Make the character NOT go through collision objects, but do it smoothly
What is the expected result
Explain what should happen when you run the game.
What is the actual result
Character either ignores collision sometimes (without the move way from collision command) or goes around collisions but in a very snappy and choppy way (with the move away from collision command)
If you’re using pathfinding then you can’t use the separate objects. The separate objects pushes in 1 direction while the Pathfinder behavior wants to stay on its path. It looks like it’s teleporting because the separate objects is holding the object in place while the Pathfinder continues to try to move. Once the path takes the object to a place that it doesn’t collide with the walls, the separate objects stops pushing away so, it jumps to the other side of the wall.
Make sure when you make the walls, that you don’t make a copy of a wall and rotate it. The behavior doesn’t always work with rotated objects. It calculates the path sort of like the object isn’t rotated. So, it might go through objects. Just don’t rotate the objects.
Create an instance of the wall that’s taller and one that’s wider and then make copies of them. Meaning say 100 x 20 and 20 x 100 instead of rotating the first object. You can use the same object just don’t rotate it.
There is a nav mesh Pathfinder. IDK if that has the same issue. I usually use the default behavior. I just make sure I don’t rotate my objects.
It can be tough to pathfind a tight area. You can use the Draw Pathfinding behavior to draw the path. Add the behavior, a shape painter and then add the action.
I set the patyhfinder grid size to 5 and 5 but it could be a little larger because I made the player smaller. It’s tough to get an object to hug the walls of a maze because the pathfinder isn’t as flexiable as it could be. It also helps to use an origin point set to the center of the object.
With an pathfinder grid offest of 8 x 8 pixels. You can’t even move the player because there isn’t a valid position. The dots are all too close to the wall. The object needs to be able to fit completely in the target x,y.
.
This would probably be the best setup for objects aligned to a 32 x 32 grid. The grid points align perfectly to the open space and the obstacles.
Hi Keith, I tried your events to draw the grid. It drew one diagonal line of dots from 0,0 to a bit more than halfway across the screen at the bottom. It looks like your screenshot doesn’t show all the events. If so, can you please post all of them? Thank you. Here is what I did.
Also, I have a Keith request, would you consider making the Show pathfinding grid events into an extension? It would be very handy for people to optimise their grid settings.
For anyone in the future who uses Keith’s show grid dots events, if your game resolution is portrait, changing CameraWidth() to CameraHeight() in both places worked for me.
I see it now, I copied and pasted the reapeat events. It should be width and width and height and height. If I remember it tomorrow, I’ll fix the image.
I actually tried to make a draw pathfinding grid extension a few weeks ago, but drawing lines instead of circles. I ran into some difficulties and went back to my project. So yes, I did wonder about the width height mis-match.
But I think it’s not just that, when I did mine back then, it was camerawidth/cellwidth that determined the y variable, not the x variable. They have to cross over, width does y and height does x. Or that was my experience anyway.
This is how I used your events and it worked for both portrait and landscape.
Yes. That looks right. It cycles through X first and then Y. So the outer is Y and height while the inner is width and X. I somewget confused with nested loops. Things appear inverted when nested.
I don’t think that’s what’s happening? Using lines instead of circles as an example, I need to know what the screenwidth / cellwidth is to know how many lines to draw in the y direction where the top of the line is at y=0 and the bottom of the line is at screen bottom?
Update
Yes, sorry Keith, I hadn’t seen your edits when I wrote this and my previous post where in fact you had already mentioned swapping the repeats to have height as the outer.
Soo my issue is fixed. If anyone needs it, i set the origin to the centre of the agent, and i set my virtual grid as 16 x 16 (because that is my pixel size), and the offset to half of that (8 x 8). Also i disabled diagonals. Now it works splendid. This is my code