BP_HandController not spawn

Hi, have issue with the motion controller actors not showing up.
the controller was working following previous lesson, laser beam pointer and teleporting all OK.

However when trying to use a new C++ class of Actor as the HandControllers using a child blueprint, it does not spawn. not visible in the World Outliner.
Could anyone help to shine some light into the issue?

using UE4.27 + ms VS 2019. Compiling no errors.

not sure if it is because the SetHand function for left and right is problematic?

in HandController.h, I have

public:
	void SetHand(EControllerHand Hand);

and in HandController.cpp

void AHandController::SetHand(EControllerHand Hand)
{
	MotionController->SetTrackingSource(Hand); 
}

in VRCharacter.cpp

	LeftController = GetWorld()->SpawnActor<AHandController>(HandControllerClass);
	if (LeftController != nullptr)
	{

		LeftController->AttachToComponent(VRRoot, FAttachmentTransformRules::KeepRelativeTransform);
		LeftController->SetOwner(this);
		LeftController->SetHand(EControllerHand::Left);
	}

if need the cpp and .h files are here
ArchitectureExplorer/Source/ArchitectureExplorer at ControllerAsActor · hexaylon/ArchitectureExplorer · GitHub

Many thanks!

1 Like

This might sound strange but try renaming the variable the controller is assigned to. I had the same issue when I was doing the course and changing to TheLeftController fixed for me.

Give that a try and let me know how you get on.

thanks for the replay, beegeedee.
I changed the name into TheLeftController and TheRightContorller,
the problem remains the same after rebuilding and restarting UE.

would it be the TSubclass declaration have issue?

TSubclassOf<AHandController> HandControllerClass;

to be honest I didn’t quite understand the use of it.

It wouldn’t be the TSubclassOf as it enables the Editor to map any controller that derives from AHandController, such as your BP_HandController.

I’ll pull down your repository and take a look at some point and see if I can figure it out.

In the meantime, close the editor and delete the Binaries folder from your project as a test. This can often resolve the issue.

Last thing to try, and I know this is an inconvenience, reparent your VR character blueprint back to a standard UCharacter and then back to the UVRCharacter - you’ll probably have to remap. This might sort out the issue.

thank you so much, beegeedee!
I figured out.
was my stupidity of not applying BP_handController inside the BP_VRCharacter slot for the Tsubclass.
No wonder it was not spawning.

1 Like

So glad you got it sorted. Thanks for letting me know.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms