After a lot of poking around, I’ve created a “mirror” object that uses a SceneCapture2D, a RenderTarget, a “plane” Shape, and a material that uses the RenderTarget as its material.
I make the texture coordinates of the plane be mirrored in the U direction, and I align the camera behind the plane. It “works” but the projection is of course off unless I’m right in front of the plane at the right distance.
Now, the next step is to get the player camera projection, and create a proper off-center frustum projection for the SceneCapture2D object. However, there are many things I’m trying to do that I can’t figure out how to do:
-
Get the player camera object from the player pawn.
1.1) I can get the player camera manager. This lets me ask for player camera position and orientation, and “View (whatever that is)” but not for FOV or projection parameters.
1.2) I’ve been looking for a “break View” node in the blueprint graph, but there seems to be no such thing, so I don’t know what’s on the inside of this view and how to access it.
1.3) I’ve tried to implement a method on my player character (ASP_Character from the animation starter pack) to return the camera proper. However I can’t figure out how to call this method.
1.4) There is no “cast to ASP_Character” node in the blueprint graph context menu.
1.5) Even if I implement a “ICameraSource” interface that can return the camera, I can’t find a way to actually extract that interface from the player character when I have it. -
Create an off-center projection matrix for the SceneCapture2D object.
2.1) If I had the player camera location, I could mirror that location across the plane of the mirror object, to get the right location.
2.2) Except I can’t find out how to set the transform of the camera of the SceneCapture2D. Perhaps I need to get ahold of this component and change its transform manually? Except I still have the problem of how to get ahold of a component programmatically (see 1.3)
2.3) Once I have the right position, I don’t know how to specify the appropriate projection matrix values to create an off-center square projection that maps to the actual mirror object. There seems to be no functions for this.
Maybe something has changed since UE 4.2, but I seem to recall that casting to subclasses was possible, and casting to/from interfaces was possible, and breaking structs was possible – now, in 4.4.3, I must be missing something, because it’s not there?
Oh, yeah – once I’ve solved 2.3, what’s the right method to set the near clipping plane of the scene capture such that it doesn’t include geometry behind the mirror object/plane?