[Minor Feature] screen_to_world() only intersects Y=0 plane #245
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
john/McRogueFace#245
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Viewport3D.screen_to_world(x, y)casts a ray from the camera and intersects it with the Y=0 ground plane. This works for flat terrain but becomes inaccurate for terrain with significant height variation, since the actual terrain surface may be at Y != 0.Current Behavior
Suggested Improvement
Intersect the ray with the actual terrain mesh or heightmap surface instead of (or in addition to) the Y=0 plane. Options:
y_planeparameter:screen_to_world(x, y, y_plane=0.0)Impact
Click-to-move on hilly terrain targets slightly wrong grid coordinates. For moderate terrain (Y_SCALE < 4) the error is small, but for exaggerated terrain it becomes noticeable. The village demo uses Y_SCALE=6 which causes mild inaccuracy on hills.
Found during village integration demo development.