Download

Line trace: detect object Within the viewport

HI
I searched in google , youtube , and here , about line trace detect enemy within the viewport ,for example slender man , when enemy behind player , and when player face enemy it will take action event like play sound impact , or enemy fade out , i saw many videos talk about line trace object pickup , or shooter .
But i don’t find tutorial how to make player detect enemy in screen .

I asked before here long time how to achieve this , and someone provide me how to make it , but the problem his idea make game drop frame in game .
Does anyone know how to make this ? i really need it , cause i’m working in my project required this idea, i hope someone who have free time explain us how to achieve this .

this is link that we are discussed about it .

https://answers.unrealengine.com/questions/340070/when-player-see-enemy-inside-camera.html

How about if you try shape trace, capsule or box. I dont think theres a cone shape trace but you can do something with capsule.
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/

Yeah i already read that , and i test them , the result the trace will hit in object only , i purchased ISP INTERACTIVE in marketplace and i found what i’m looking for , he made many blueprint one of these is eye switch , the idea of this , you have two object one is visible the second not invisible , if you play you will see first one , if turn player and the you back you will see second one in same area , i tried to edit his blueprint , but i’m little confuse

is this just in general or do you have specific things you want to know are in view port?

Example if your looking for a bool is such and such in view port that I don’t know about but you can track a few objects. Keep in mind this requires tracking a objects location every frame.

So if you have kb object no big deal it’s basically like a radar…

You can dot prod the actor location to your forward vector and find the angle is positive. And also check if length is in range this does mean you see it through walls of course. And additional line trace if that is true would need to be done to know if it’s actually visable.

But it’s only heavy on computation if your trying to get a ton of actors information.

Explain more and I’ll try and see if I have a solution.

You need to check whether the actor is in the camera view frustum.

You can do this manually against the frustum planes.

Another approach is to leverage last render time:
https://docs.unrealengine.com/latest/INT/BlueprintAPI/Rendering/WasRecentlyRendered/index.html

This approach might work for you if there is a single actor e.g. Slenderman that you are concerned about.

Here is an old discussion on it:
https://answers.unrealengine.com/questions/4830/how-to-figure-out-if-something-can-be-seen-by-the.html

Back , after i find my answer , first thanks for your replay , second see video in below , i managed to make detect enemy in view port

Now this is really what i want to make it , i want when player see enemy , the enemy will be dissolve or like fade out , but the problem can not access other blueprint
is anyone know how to make this work ? i tried by cast to and new variable , too bad ???

Oh come on no one know i already provide video

Reminder Please

You’re almost there! The problem is that you never set up the New Var 0 variable. Think of your “New Var 0” variable as a Box that can contain “Weeping angel” objects inside of it. Right now it has the ability to contain such objects, but it is empty.

So the easy fix is, when you use the “Get all actors of class” node to get the location of the enemy, save the resulting object (the one you’re getting the location from) into your “New Var 0” variable. Then you’ll be able to call the “Dissolve” event for that specific “Weeping angel”.

Thanks for answer i managed to fix this as you said , after detect function i put get all actors of class then i put new var to call dissolve and i linked get all actors of class to Dissolve

Its work but there is one problem after call dissolve it will set new material in body i selected but it will not animation for dissolve, i mean set scalar parameter , after sometime i figure out how to make play dissolve animation , by delay , i don’t know why? but delay function will work here example

&stc=1

Thank you for your support