Passing components to sub-actors (C++)
I am trying to create a set of C++ classes that provide VR functionality. The structure that I am using is that my player Pawn class owns two sub-actors (i.e. classes derived from AActor) for the left and right MotionControllers.
In the BeginPlay() function of my Pawn I have the following:
On AMotionControllerActor I have the possibility to set a UStaticMeshComponent*, which is used for the visualization of the MotionController ingame. So in AMotionControllerActor I do the following:
If I would use the MotionControllerActor directly, this allows me to set the mesh from the Details pane of the Unreal Editor. Which is what I want.
However, because I spawn the AMotionControllerActor inside my player Pawn class I can no longer access the MotionControllerActor directly (which makes sense). So I would like to expose the UPROPERTY for the left and right MotionController directly from within my Pawn to the MotionControllerActor. In other words: I want to be able to pass through the UStaticMeshComponent for the Left and Right controller directly from the Details pane associated with the player Pawn to the AMotionControllerActor inside the Pawn.
Maybe this is extremely simple, but somehow I have been unable to come up with a good method to accomplish this.
asked Oct 12 '16 at 06:36 AM in C++ Programming
I did'nt test.
But i will keep the static mesh as UProperty in your Player Pawn And when you span your subActors, you call a "Initiliaze" method wich take a UStaticMeshComponent* or a class
define your initialize function in your "AMotionControllerActor"
then the call should like:
don't know if it works but you can then create the mesh and attach it to your rootcomponent. Hope it helps
Follow this question
Once you sign in you will be able to subscribe for any updates here