Raycasts Miss Hitting Terrain Frequently

Issue Type: Other
Impact: High
Frequency: Constantly
Date First Experienced: 2021-02-11 22:02:00 (-05:00)
Date Last Experienced: 2021-02-12 03:02:00 (-05:00)

Reproduction Steps:
I cannot guarantee you will be able to reproduce the issue, as my it isn’t occurring for my friend. The issue occurs at every place I edit.

Expected Behavior:
Raycasts properly intersect with the Terrain.

Actual Behavior:
Raycasts only very rarely intersect with Terrain. This causes the terrain brushes to no longer function properly, draggers to no longer work over when over terrain, and more.

There are no invisible parts or mesh/unions blocking collision where I am moving the brush.

This breaks my workflow, as a good portion of the terrain in my map is no longer editable as I cannot use the brush on it.

EDIT: The issue is with raycasting, not the Terrain Editor plugin. It happens at any height, and has been happening since the Roblox update on February 10th, 2021.

EDIT 2: A workaround has been posted in the replies. Specifically this reply by @DevelopingRepo.

23 Likes

Do you have a part called Baseplate? The terrain brush looks for both Terrain, and Baseplate - the intention there was to make it easier to start adding terrain from a brand new place.

The logic is:

  • Cast a ray that’s only interested in terrain and baseplate (if it exists)
  • If we hit something, use it
  • Otherwise mathematically intersect the ray with the y=0 plane
  • If that’s successful, we use that
  • But if it failed (e.g. camera is above the plane and looking up), use a point some amount of studs in front of the camera
6 Likes

We do not have a part named baseplate. With the size of the map it’s not feasible to have one. I tried adding one to see if it made a difference, and it did let me move the brush around on that part regardless of the Y position. However the issue here are these points:

  • Cast a ray that’s only interested in terrain and baseplate (if it exists)
  • If we hit something, use it

Following your logic, shouldn’t the ray be intersecting with the terrain regardless of if a baseplate is present? The terrain exists there, it just acts as if it does not exist below the point Y = 0. Basically I cannot interact with terrain below that point without a baseplate now.

So taking what I understand, it seems that the editor brushes are failing to properly detect terrain being hit by the ray it casts if said terrain is below the XZ-plane (Y < 0). I apologize if I’m misunderstanding the mechanics behind it. Please feel free to correct me.

3 Likes

I’m also experiencing this issue, It’s really hurting my workflow as I’m trying to add more terrain to my game, but it seems like it’s locked to Y=0.

3 Likes

Yep, this is what it should be doing. (Unless the terrain is 10k+ studs away as there’s a limit to the raycast API).

I’m not able to reproduce this myself, so would appreciate it if either of you have a small example place file I could take a look at :slight_smile:

5 Likes

I can DM you a copy of the place that I’m working which has the problem. I took the liberty of modifying the terrain plugin to get it working enough to debug the problem. It seems that the issue is not with the Terrain plugin itself, but either WorldRoot:Raycast() or the Terrain Instance.

When in studio (non-Run mode), WorldRoot:Raycast() frequently misses the Terrain Instance. I believe it was changed in the last update, or perhaps a result of some FFlag. I do not know if this is due to changes within the Raycast implementation or a recent Terrain change.

Here’s video of the modified terrain plugin where I added debug prints directly after the raycast call. You can see in the output it rarely intersects with the Terrain Instance.

4 Likes

I’m also experiencing the same issue, but also involving terrain in which the brush or part clips through the terrain and sets a new baseline at Y=0
https://gyazo.com/36a30daedfc7028b69380b532a171256

https://gyazo.com/87dd3ae98060676a0ca4bf80fa3239b4

https://gyazo.com/b151625e4e29e1b150605fd20fdaa6b1

2 Likes

I’m also experiencing this issue, using the brush tool either clips through parts or random patches of terrain and doesn’t go past Y=0.

4 Likes

Yeah, it’s annoying. I can’t finish most of my projects with deadlines because of this issue. I hope it can be resolved.

3 Likes

I think this is not only happening with terrain brush, it’s also happening with attempting to drag an object onto a piece of terrain.

In the video shown below, I tried to drag a structure onto a heightmap generated terrain (Heightmap 1) and I expected this structure to bound itself to the terrain. As shown, it is being extremely weird and it just doesn’t bound to the terrain. The same issue is happening to the terrain brush and other things.

For the record, *I tried using baseplates to solve my problem, but it didn’t work as this is a piece of heightmap and we’re working with tons of it, so essentially it would be tough for me to cover up the entire map with baseplate at various different heights.

Update: Creating a baseplate or baseplates do not fix the issue.

3 Likes

The issue seems to be that raycasting can fail (and frequently does fail) to intersect with the terrain. It only happens in edit mode from what I can tell. This means anything that involves raycasting is effectively broken with terrain. Draggers, the terrain editor, other plugins, etc. Hopefully there’ll be a resolution to it in this week’s update or a FFlag revert if that route is possible.

1 Like

Just encountered this. Very annoying.

1 Like

This is really disrupting my workflow. I haven’t been able to fix or add new terrain to my game for the past few days because of it. Hope it’s fixed soon.

1 Like

I see, all hopes high for them to fix it. A question for you though, how were you able to print the raycast? Is it a script or is it a setting that can be changed?

Lovely,

No baseplate here!

Terrain Tool raycast failing

I would really appreciate if this was fixed soon, as though it’s possible to work around, it’s terribly inconvenient.

One strange behavior is that the raycast only fails from certain angles seeming to be a chunk error, and yet it behaves fine with part dragging, avatar collisions etc.

I edited the built in terrain plugin to see if I could find a temporary fix. When I discovered it was a raycasting issue and not related to the terrain plugin I gave up. There’s not much we can do about the internal raycast mechanism failing.

1 Like

It also affects draggers for me. The issue seemingly only occurs in edit mode. When in play mode/run mode the issue disappears.

Same here, running the game and opening the terrain editor completely solves the issue. Knowing Roblox though, I could also see this as them half**sing this and only half rolling out this update to edit mode without applying any changes to the run mode. Nonsensical but I know you see it happening too.

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

8 Likes

The Raycast is very inconsistent, I’m trying to use the paint tool and the terrain dragger constantly disappears…

5 Likes