Godot Version
Godot Version 4.5(Steam Version)
Question
Hello!
I'm somewhat new to Godot an Im encountering a problem that I feel like im missing something.
What Im Trying to Do:
A level Editor, a raycast casts from the camera, hits the gridmap object, gets the colliding position, converts it to local_to_map, and uses set_cell to place an object.
It works completly fine, but whenever I try and place a cell in Negative Position, it no longer works as intended.
For example, These cords works fine (1, 5, 3) etc
But attempting to return for example (-5, 0, 0), it doesn't work as intended.
I'll place code and images below.
func raycast_mouse_pos():
#Get Mouse Pos
mouse_pos = get_viewport().get_mouse_position()
#Set target pos with ray length(1000)
raycast_mouse.target_position = pcamera.project_local_ray_normal(mouse_pos) * ray_length
raycast_mouse.force_raycast_update()
#If colliding, update points
if raycast_mouse.is_colliding():
#Return collision point
collision_point = raycast_mouse.get_collision_point()
#Convert point into snapped grid
collision_rounded = collision_point.snapped(Vector3(1, 1, 1))
#Convert snapped point into cell cords
collision_point_cords = gridmap_objects.local_to_map(collision_rounded)
The Green block is where the returned value is placing.
As you can see in the bottom, it places and works fine in the positive grids.
In the Top, anything along the white(Negative) doesn’t work, and seems to snap it back to a positive. You can see the green block is inside 0,0,0, instead of the outside in the negatives.
I feel like im missing something incredibly obvious here.
Am I snapping it wrong?
Do I need to snap it?
Thank you in advance for anyone answering my questions.
I’d be happy to provide more detail if needed.



