4.24 Can't get Motion Controller location.

I recently updated my VR C++ project from 4.21 to 4.24 and GetComponentLocation() no longer works.

USceneComponent::GetComponentLocation()

Did this change recently?

This is what my hand blueprint(s) look like:

Here is what my code looks like for spawning and attaching the hand blueprints:

This is the code for getting the location of the motion controller:

Can you show your code and what is not working? I am confient that I have used GetComponentTransform() in 4.24, so GetComponentLocation() should work as well.

I don’t have any other code to provide. My left and right hand blueprints have a motion controller component as the root and a skeletal mesh as the child of the motion controller. The mesh just sits on the floor when I move the controllers. Putting in debug statements show that GetComponentLocation’s and GetActorLocation return value do not change. Is there a C++ example for 4.24 I can compare against mine to see what changed? I modified my hand blueprints to be similar to what the VR project example has for 4.24.

Could you please send an image of the blueprint setup/whatever c++ code you are trying to execute? Going of what you’ve provided sofar, all I can help you with is to follow this documentation.

If you have added the motion controller to your actors component list, and printing the GetComponentLocation() of the motion controller component returns no change in location, then something is not working with the hardware I would assume. GetComponentLocation() is not the issue here.

Thanks for the help, I attached the screen shots you asked for. I can see the motion controllers in the steam vr menu but not my game.

Ok let’s break this down, there are to many dependencies for me to help you without having the code.

Could you first try to simply drag the LeftHandBlueprint in to the level. Comment out the tick function in ABaseHand. Dont include the character, just hands. See if the hand starts moving with the motion controller. The MotionController should update and move without any code needed, meaning that anything that is attached to that component will also move.

Understandable and I agree.

I commented out the code for spawning the hand blueprints and the tick, then I dragged the hand blueprints into the level but they still don’t move. I took a look at the motion controller component in the debugger and it looked like this:

Could you send the BaseHand .h and .cpp files and I can have a look at it that way?

Sure no problem.

BaseHand.h: BaseHand.h - Pastebin.com
BaseHand.cpp: BaseHand.cpp - Pastebin.com

In your constructor:

//myMotionController = CreateDefaultSubobject<UMotionControllerComponent>(TEXT("MotionController"));

Why has this been commented out?

Then in BeginPlay you do:

myMotionController = this->FindComponentByClass<UMotionControllerComponent>();

This will not work, is there a reason for this?

I found in the updated VR template that the motion controller and the skeletal mesh were added in the blueprint and not dynamically created from the class. Originally I had it the other way where I spawned the components and attached them dynamically. But your saying it wont work?

Ok I see, I don’t see a reason why it wouldn’t work to declare the motioncontrollercomponent in c++. For the sake of readability and code efficiency it is much better than to add it in blueprints and then have to find the component in c++, it is sort of counterintuitive. I try to think: “If I need to write c++ code, I need to define/declare the affected variables/components in c++”.

Could you try to create a pure Blueprint actor, add the motion controller and a static mesh component (as in the guide I linked earlier). See if this simple setup works first. We take it from there.

Makes sense. I changed it back but I’m still not getting anything, here are the changes I made:

Just tried, I made two blueprints for left and right hand, they have Actor as the base class. Added a motion controller component and set it as the root. Then made a skeletal mesh component and attached it as a child to the motion controller. I then dragged both blueprints into the scene and they just sit there not moving.

If you have followed the previous guide I linked, and it is not working, then something is either not working with your hardware, or Epic has changed something in the source code. I don’t have access to motion controllers atm so can’t test this unfortunately. Maybe someone else can verify that it should work in 4.24?

Hi, see this post: UE 4.24.1 - VIVE/Index - No Motion Controllers Detected - XR Development - Unreal Engine Forums

Sorry but I tried this already. I followed the guide yes and it was all working before with 4.21. I also regenerated steam vr bindings as this post mentioned but either way that should not effect just the motion of the controllers. Not sure what to do next.

I figured it out, I needed to set the owner of the spawned hands, here is the solution: