You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a HeightMapShape to a static body in the editor (through the use of tool scripts) works fine, until the body is moved to a non-origin position. All raycasts that are not going through the AABB it occupied at origin will always miss.
This causes other plugins relying on raycasts to fail, and the Snap-to-Floor functionality also fails.
This does not reproduce in a running game, and it only happens with this type of shape.
It happens regardless of the body being moved or being loaded not at origin.
Reproduction steps
Investigating what is actually happenning wasn't obvious at first, so I created a new plugin which allows to "see" the result of raycasts going from the camera to every visible pixel, allowing to visualise collisions directly: https://github.com/Zylann/godot_collision_scanner
(see the issue linked above for more screenshots).
Open main.tscn: it contains a tool script which setups a heightmap with collider.
Go to ProjectSettings, and enable the Collision scanner plugin. The view will darken, and after a few seconds you should see raycast results, matching the terrain.
Now click on the Terrain node, and translate it by about 50 units along X or Z.
Move the view a bit to force an update of the collision viewer: the view will turn dark again, and after a few seconds you'll see updated raycast results: only those that went through "the AABB the terrain would cover if it was at origin" will show up, everything else will remain dark. This is wrong, it should still match the visuals.
Note: the body did call PhysicsServer::body_set_state(), and you can see collision actually matches the translated body, just not outside of this AABB. Something else must be missing.
The text was updated successfully, but these errors were encountered:
I am a newb so I am not 100% sure if this is related but I am running into a similar issue using intersect_ray in the editor with a tool script.
If I put an object in the world with a collider and run the tool script for checking overlaps with intersect_ray it works, but if I move the object and try again it doesnt work until I re-check the collision layers on the object.
The function to check intersects is this (nothing special)
func check_collision(ray_start, ray_end, coll_m):
var space_state = get_world().direct_space_state
var hit = space_state.intersect_ray(ray_start, ray_end, [], coll_m)
if not hit.empty():
print(hit)
return hit
Godot 3.2.1
Godot 3.1
Windows 10 64 bits
Following this issue (have a read for insights): Zylann/godot_heightmap_plugin#129
Adding a
HeightMapShape
to a static body in the editor (through the use of tool scripts) works fine, until the body is moved to a non-origin position.All raycasts that are not going through the AABB it occupied at origin will always miss.
This causes other plugins relying on raycasts to fail, and the Snap-to-Floor functionality also fails.
This does not reproduce in a running game, and it only happens with this type of shape.
It happens regardless of the body being moved or being loaded not at origin.
Reproduction steps
Investigating what is actually happenning wasn't obvious at first, so I created a new plugin which allows to "see" the result of raycasts going from the camera to every visible pixel, allowing to visualise collisions directly:
https://github.com/Zylann/godot_collision_scanner
(see the issue linked above for more screenshots).
Here is a simplified project:
HeightmapTranslated.zip
Open main.tscn: it contains a tool script which setups a heightmap with collider.
Go to ProjectSettings, and enable the
Collision scanner
plugin. The view will darken, and after a few seconds you should see raycast results, matching the terrain.Now click on the
Terrain
node, and translate it by about 50 units along X or Z.Move the view a bit to force an update of the collision viewer: the view will turn dark again, and after a few seconds you'll see updated raycast results: only those that went through "the AABB the terrain would cover if it was at origin" will show up, everything else will remain dark. This is wrong, it should still match the visuals.
Note: the body did call
PhysicsServer::body_set_state()
, and you can see collision actually matches the translated body, just not outside of this AABB. Something else must be missing.The text was updated successfully, but these errors were encountered: