bugfix(heightmap): Fix ray casting in BaseHeightMapRenderObjClass::Cast_Ray (2) - #2869
bugfix(heightmap): Fix ray casting in BaseHeightMapRenderObjClass::Cast_Ray (2)#2869xezon wants to merge 6 commits into
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp | Updates terrain-bound clipping and iterative ray narrowing. |
| Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp | Skips camera clip-plane updates for negative far distances. |
| Core/Libraries/Source/WWVegas/WWMath/castres.h | Clarifies the meaning of inside-start collision results. |
| Core/Libraries/Source/WWVegas/WWMath/colmathline.cpp | Sets contact points for line-box collisions that start inside a box. |
Reviews (5): Last reviewed commit: "Allow ray casts to start inside all boxe..." | Re-trigger Greptile
I tested this and it appears to work correctly now. Haven't looked at the code yet. |
|
In my effort to understand how |
|
More refactor is beyond the goal of this change so I will leave it as is in this pull. |
|
Fair enough. Perhaps I'll do a follow-up. |
47cc702 to
a9cc94b
Compare
I added another commit because I realized we can simplify it and get rid of the new math mumbo jumbo by allowing inside collisions for the first terrain box. |
|
I'll try to have a look at it in a bit. |
|
I noticed that the cursor feedback changed between retail and this project for unit orders to spots outside the map. I suspect it's the result from previous ray cast changes. Should it be fixed? It looks purely visual. Notice how it changes with a slightly different camera angle. VideosRetail:gen_zh_move_order_retail.mp4This project (main branch and this branch):gen_zh_move_order_tsh.mp4 |
I suspect it is also related to short far Z. I have not seen that on the maps I tested with. Can you share map? |
https://github.com/TheSuperHackers/GeneralsGameCode/pull/ 2846#issuecomment-5006788343 |
|
Were you able to reproduce the issue? |
|
Yes it is definitely caused by the far clip plane in |
|
A potential workaround would be to extend the far clip plane during |
|
It's not a big deal as it's only visual feedback. I'm okay with ignoring it for now if you don't see a reasonable way to fix it. |
|
Yes it would be nice to restore original look, but I do not know how to elegantly do that. I think we need to compare visuals of Special Power planes at the edges of the map. If they also look strange, then we definitely need to do something. |
This change is follow up for #2836 and applies more fixing in the Cast_Ray function.
Before this change the ray cast was failing if the camera was positioned below the max terrain height. The logical consequence was that no unit could be ordered to move anywhere on close zoom.
With the fixed logic the initial terrain hit box is assembled in a way that the ray cast has a chance to hit it before moving forward with the narrowing search.