Camera and Collision Question

Hello

A couple of questions on where i am stuck and if anyone can help that would be great

Question 1

I have made a very simple scene, with just a chair which when you enter its collision volume the material changes and text appears above it. Most of this was followed from the Unreal Wall Sconce Light BluePrint tutorials.
This all works fine for me

However what i want to do now is instead of the player entering the collision volume and changing the material/text appear, I want the player camera to turn this on when the camera looks at the chair.
What is the best way to do this?
I tried by adding a box collider making it long and narrow and then attaching this to the camera, hoping that when the camera looks at the chair, the box linked to the camera would collide with the chairs collision and then activate the chairs blueprint, but its not working or at least i have not set that up correctly?

Question 2

Another question I have is, how do i stop the camera from moving when in game, I just want the camera stationary and the player to just be able to move the camera view around but not move position?

Any help would be greatly appreciated

Thanks

For your first question, you’re going to want to do two things:

Make sure that your chair blocks the Visibility channel in the collision settings.
Secondly, run a single line trace using the direction of the camera and use a class filter afterward to check if the chair was collided with, then have those trigger the changes to the chair you described.

If you want to use the box method you described, just make sure that the visibility channel is checked for “blocked” in the collision settings of the chair, and that “generate hit events” and “Generate overlap events are ticked”.

As for your second question, you’ll want to unchild the camera from the Spring-Arm component holding it in its place (if you’re using a template, it will likely be using a Spring-Arm component), but keep the root component of your Pawn as the parent to the camera. Then, you could either handle input events from the pawn or the Playercontroller or the Pawn (Playercontroller is sometimes considered better form, but using the Pawn produces less headaches imo) to move the camera as desired.

EDIT: I misread what you were asking in your second question. Disregard my response there.
What you could do then is have the camera be a child of the root, and the pawn mesh as a child to the root. You would then have all the inputs that handle the movement move the mesh component rather than the whole blueprint. Then, hook up your inputs to rotate the camera. Now, your blueprint will never move from its original location, rendering the camera stationary, but you would still be able to move your character.

Thanks very much for the reply
I`m pretty new to blue prints so my next question is how do i run a single trace line using the direction of the camera like you mentioned, I have tried searching around for a tutorial but could not see anything? Could you point me to a tutorial which covers this area?

Thanks again

I have been trying to figure that one out myself for a different project. I’m sure it’s doable - other projects use it all the time, especially shooters. I would suggest using the box method for now just as a placeholder until someone else can swoop in and offer a solution.

In this video I think I show how to do a trace from the camera in the direction you are looking.

Hi James

Thats great, thanks so much for the link. I have it working now by doing the trace line from the camera.

One question i have is, I followed your tutorial and when i press the right mouse button when i hover over the chair it changes material ( as intended ), but do you know how i would go about it so that it would interact with the object without pressing the right mouse button. So basically when i look at an object and it hits the trace line then it just automatically plays its interact state ( changes material ), rather than having to press a input?

It might not be possible, but thought id ask

Thanks again

You would probably just do the trace every Tick instead of base on an input event. You would probably want to remember which object you are ‘looking’ at so you only activate it once, and can deactivate it when you look away.