the methods GetActorLocation and SetActorLocation can be used only with children classes of the AActor class, you can’t use them with a UStaticMeshComponent. To move a component, there are other methods in the class USceneComponent, the class from which inherits UStaticMeshComponent. For example you can use SetWorldLocation. And you need to make sure that you component has a mobility Movable. you can set that with the method SetMobility(EComponentMobility::Movable).
Can you please explain more your problem ? what do you mean exactly by data received in other class ? If you have a reference to the data in your class with the StaticMeshComponent, there is no problem you can directly use the SetWorldLocation but if you want to move the location from the other class in which you have the data, in that case you need to have a reference to your Actor with the StaticMeshComponent, then you get the desired component and move it.
To get your component you can use the existing Unreal Engine methods for example GetComponentByClass or you can simply add a Getter to you Class :
Hello, my main goal is to detect any motion through a webcam with the help of opencv and move the objects placed in the world. I have acheived the first step i.e. detecting motion by integrating opencv within my project. Then I created a UStaticMeshComponent and placed it in the world. My question is how can I access it’s GetActorLocation and SetActorLocation because my opencv runs on a different thread in different class?
Also, please let me know if my approach is correct considering my goal is to achieve user interaction without use of much hardware
Thanks
Hello what I meant was, the DoWork method from the DetectingChange class runs on another thread opening an opencv window, So based on that data I want to move my mesh’s location.