I’m new to Unreal and i come from nearly 10 years of experience in Unity with the majority of that time using Playmaker the state system for coding.
As the tile suggest i need some help on how to use line trace coorectly for picking up items, turning doors, turning lights on and off. With a widget that pios up when looking at the item.
Ive tried to find videos on this but i cannot find this specifically. The best i foud was firing a line trace when a buton is pressed.
I would need it firing every frame for the widget pop up when looking at an item.
In Unity i could just fire a raycast from the camera, save the gameobject as a variable and a bool if an object was hit.
In the item i want picking up, i can check to see if its been hit, then check to compare it is the correct item, then pop up a widget, press a button and do whatever i wanted.
As i say i am very new to blueprints, so any help at all qould be great. Thanks.
How I did it (combines both world):
Trace not not every frame, but by a timer; about 10 times a second will be enough for players not to pay attention to a “lag” between turning to an object and widget popping out. There’s no use to do it by tick; it will consume resources without much practical use.
1.1. Compare the new hit actor with the previous hit actor, and do nothing if it’s the same actor. This will allow avoiding a lot of unnecessary code running over and over.
Trace when pressing Use as well. The 0.1 lag from the trace may be okay for human eye, but will screw up interaction if you quickly rotate and press Use =)
Stop tracing timer when you’re carrying a picked up actor, unless you have something else specific in mind.
Thank you fpr the response, i got it working.
Im having another issue with having “enable input” on multiple interactable items.
How qould i go about “disabling input” if the line trace is not hitting the object?