I’m trying to allow my middle mouse wheel, when scrolled in one direction or the other, to push or pull a specific mesh away from or towards my camera. The mesh should only be allowed to move while I’m looking at it.
This is a picture of the level, except I have 10 more panels (they’re not included purposely because the textures contain sensitive information) that create a 3 row by 4 column matrix.
My solution thus far has been to take the player character’s camera and attach (as a child) a long, narrow box collider to it. See below:
My specific panel’s blueprint then has an OnComponentBeginOverlap event that responds when the camera’s box overlaps it. Upon overlap, I first set the rotation of the mesh to face the camera. Then, to make it so the panel is changing its distance to the camera based on my mouse wheel input, and to make sure it only activates this feature while I’m looking at it, I set a bool isColliding to true, which is attached to an event tick. I have an EndOverlap that changes the bool back to false. Below is picture of part 1 of this mesh’s event graph (white-out on overlap is deliberate):
In the following event graph pic (in the same blueprint as above) I set the mesh’s transform on begin play so I can return it there when I look away from it. To constantly interact with the mesh, my event tick branches with the IsColliding node to adjust the distance of the mesh to the camera based on the float multiplied against the forward vector, which I’m hoping to adjust by using my middle mouse button to raise and lower the index assigned to an array with 15 elements from 1 to 1400. Also, as you can see, when IsColliding is false (i.e. when I look away) the mesh resets to its original position.
Finally we have the PlayerController, which has the mappings for middle mouse scroll up and down (I’ll spare you the photo). I’m trying to to get these to interact with the indexes in each of the mesh blueprints. I’ve tried to do an interface, but I’m nearly certain I wasn’t doing it right.
I’ve been working on this longer than I care to admit, and would really appreciate some help if anyone knows how to solve this dilemma. Bonus points for a way to solve it without using an event tick for each blueprint mesh (as my current setup does).