Godot Version
4.3
Hey all, I switched from 4.2 to 4.3, and now I can’t get the physics to work for my GridMaps! Not sure what the problem is.
When I am creating a MeshLibrary, I start a 3D node and add my models. FBX. and I add a static and collision node to all those models. I add a shape to my collision (all boxes for testing) and then export the MeshLibrary.
When I whip up a level using a GridMap and that new MeshLibrary, I can’t get the collisions I need.
I really only need a camera to raycast to the GridMap. I need to get the position of where the raycast hits. If there is a way to do this without adding collisions directly to the GridMap, that would be great too!
Any help at all here would be great!
1 Like
func _unhandled_input(_event):
if Input.is_action_just_pressed(“mouse_left”):
get_world_pos()
func get_world_pos() → void:
var space_state = get_world_3d().direct_space_state
var mousepos = get_viewport().get_mouse_position()
var origin = project_ray_origin(mousepos)
var end = origin + project_ray_normal(mousepos) * 1000
var query = PhysicsRayQueryParameters3D.create(origin, end)
query.collide_with_areas = true
var result = space_state.intersect_ray(query)
if result:
print(“Result”)
var pos_x = snappedf(result.position.x, 0.01)
var pos_y = snappedf(result.position.y, 0.01)
var pos_z = snappedf(result.position.z, 0.01)
var new_pos = Vector3(pos_x, pos_y, pos_z)
print("Clicked Ground ",new_pos)
My current code to try and raycast to the GridMap
I found it, it was the import settings. You can turn on the physics and reimport.
1 Like