Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange line of sight behaviour #157

Open
JaredP94 opened this issue May 18, 2021 · 10 comments
Open

Strange line of sight behaviour #157

JaredP94 opened this issue May 18, 2021 · 10 comments
Assignees
Labels

Comments

@JaredP94
Copy link
Contributor

Hi @npruehs!

Been a little while, hope you're well :)

I've been attempting to implement the complete fog of war functionality, with the last step being the line of sight feature. On the demo project, it works as expected, but I'm seeing fairly unreliable line of sight behaviour within my project (video attached below).

I've played around with the Level Height setting of the vision volume but either yielded the same behaviour, or reduced to a value where line of sight was never blocked by objects.

Any advice on where to dig further into this?

Thanks!

UnrealCoH.-.Unreal.Editor.2021-05-18.21-21-01.mp4
@npruehs
Copy link
Owner

npruehs commented May 25, 2021

Hey @JaredP94!

Sorry for the late reply. I assume that your actors don't have "Ignores Height Levels" checked on their RTSVisionComponent.

Assuming that's not the case, the plugin will compare the height level of the tile being looked at to the height level of the moving actor. These tile heights in turn are cached when the game starts (ARTSVisionVolume::Initialize) for performance reasons, so my next question would be whether your level geometry (vision obstacles) are in place from the very beginning, or not.

If so, the tile height is determined by casting a ray from "infinity" (Z = 10000.0f) downwards (to Z = -10000.0f) against the HeightLevelTraceChannel of your vision volume, so you'd want to check whether these traces are actually able to hit your vision obstacle.

If so, the resulting Z value is divided by the Level Height of your vision volume (and floored) to get discrete height levels.

If that resulting height level of the tile is above the one of the actor, the actor is considered to have no vision on that tile.

If the actor has vision on a nearby tile, the algorithm continues to check the next tile along line of sight using a simple Bresenham algorithm, until it hits a tile the actor doesn't have vision on.

Does that make any sense to you?
Nick

@npruehs npruehs self-assigned this May 25, 2021
@npruehs npruehs added the bug label May 25, 2021
@JaredP94
Copy link
Contributor Author

Hi @npruehs,

Appreciate the detailed feedback!

> I assume that your actors don't have "Ignores Height Levels" checked on their RTSVisionComponent.
That is correct.

>so my next question would be whether your level geometry (vision obstacles) are in place from the very beginning, or not.
All objects in question are static and placed in the level prior to startup.

> so you'd want to check whether these traces are actually able to hit your vision obstacle.
I've validated that the objects are well within bounds.

What's interesting is how some objects seem to block vision from one direction, but not from the other, or that objects of equal height seem to exhibit completely different vision blocking. I thought the rugged terrain might have an impact since the demo level is flat, and the shift in terrain is causing some interesting behaviour, but I would expect a bigger tile height to resolve that (and it doesn't really affect the main point of reliable vision blocking from tall objects).

@npruehs
Copy link
Owner

npruehs commented Jun 5, 2021

"objects of equal height seem to exhibit completely different vision blocking"

Technically, this could happen if you're you're not using enough tiles, i.e. we use too few rays to properly sample the heights everywhere.

"some objects seem to block vision from one direction, but not from the other"

This however is hard to explain and sounds more like a bug to me...

Hard to tell without having a closer look on your setup. Any chance you might be able to share your project, or a minimal repro if you're more comfortable with that?

@JaredP94
Copy link
Contributor Author

JaredP94 commented Jun 13, 2021

> Technically, this could happen if you're you're not using enough tiles, i.e. we use too few rays to properly sample the heights everywhere.
I have experimented with an increased number of tiles, but it did not appear to yield any better behaviour. Interestingly, I did notice that bumping up the tile size seemed to hurt the minimap rendering (but I'll comment further on that when I test further this week).

> Any chance you might be able to share your project, or a minimal repro if you're more comfortable with that?
This is certainly something I can do. It is currently private, so I would need to add you as a collaborator to look at it. I have also made the transition to UE5EA (yay!) so unless you have it installed, you would need to checkout a commit prior to the conversion. Let me know if you're happy with this? Obviously I would like to make it as quick and easy as possible for you :)

Thanks again for digging into this!

@npruehs
Copy link
Owner

npruehs commented Jun 16, 2021

Sure, whatever works for you. I've got UE5 installed as well :)

@JaredP94
Copy link
Contributor Author

Nice, that should work out the box then!

Don't mind the current state of things, seems upgrading to UE5 has broken quite a few things in our project, most notably around animation. Guess it's time to hop over to control rig once and for all :)

I have added you as a collaborator, please shout if you have any issues getting everything to build and run :)

@npruehs
Copy link
Owner

npruehs commented Aug 24, 2021

Which repo is that? I don't think I got a notification - I might have just missed it, though. Filters show nothing.

@JaredP94
Copy link
Contributor Author

Sorry for the delayed response!

I see the invitation is still pending - you should be able to access it here: https://github.com/JaredP94/Unreal-CoH

@npruehs
Copy link
Owner

npruehs commented Oct 3, 2021

It says "This invitation has expired."

@JaredP94
Copy link
Contributor Author

Hi @npruehs, sorry for the delay - life has been a bit busy :)

I've just sent a new invite!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants