Noob here, im trying to create some pathfinding for my tactics game prototype, u ran some code to detect a tile and print its coordinates. Whenever i run it an click on a tile it says its “out of bounds” i realized this happened because my grid was not at (0’0) and instead was in the of my viewport (which is 1920,1080).
Is there any way for me to move my origin to the center of my viewport? It’s really annoying to have to move all my assets to viewport center everytime and now this origin nonsense is screwing my pathfinding over. :^(
If possible i would also like some clarity regardjng the use the viewport. Is it actually the window my game is in or does it just represent that window? I tried moving the camera onto 0’0 and that worked but that means i’d have to do that with EVERY scene i made before. So does this mean the camera acts a proxy viewport? Anyway if theres a method to move 0’0 to viewport center please let me know!
It sounds like you are trying to do everything by yourself instead of relying on Godot to do things for you. Hard to say for sure without seeing your code or node structure though. It would help if you actually descried the problem you are having. You didn’t even mention if this is a 2D or 3D game. I get you are frustrated, and if you’re just venting, that’s cool. But if you’re not…
Is this a 2D or 3D game?
Why are you tring to roll your own pathfinding? Did NavigationAgent2D/3D and NavigationRegion2D/3D not work for you?
Are you using global coordinates or local coordinates?
Why did you have to move your camera to (0,0) and was that local or global coordinates?
It sounds like you are trying to use global coordinates with your TimeMapLayer. Is there a reason you’re not using relative coordinates?
Sorry if i came off as venty. Im just not very versed in this sorta stuff.
The game is 2D
Im not using Navigation2D or whatever the other thing was, actually i have no idea what those are (gasp)
I think i’m using global coordinates, i have no clue how to tell or use local coordinates.
I moved it because my 0,0 is at the top left of the screen and not inside my viewport (which is 1920x1080) so i just made a camera and put it in the middle of 0,0
Don’t know what that is (i am a noob)
Tilemaplayer (i thought Tilemaps became irrelevant in godot 4?)
Im following a tutorial for grid based moved with Astar pathfinding.
By the way, i (think) i found a serviceable solution which just involves me moving everything to 0,0 and using cameras. But if theres any insights and solutions that a pro like you might have i am open to it.
Using AStar is fine, but it’s basically getting geeky about math for fun. If you continue to have issues with it, I recommend checking out tutorials on NavigationAgent2D and NavigationRegion2D. They do all the heavy lifting for you and are much easier to use.
Just generally the internet and youtube.
I forgot to mention im making a tactics game akin to fire emblem and disgaea which has multiple units. Whoops.
That might be why i’m hearing only about Astar, maybe its best suited for that.
Perhaps. I know nothing about either of those games.
Keep in mind that a lot of people come from other game engines and so they do tutorials based on the knowledge they have. AStar is a common algorithm. That’s why it’s popular.