AttachTo and UCapsuleComponent
I run into some issues trying to set the relative location of my camera in c++, the camera would always be placed relative to 0,0,0 in world coordinates. I figured, that this is probably due to the parent of the camera not being set, before the setRelativeLocation took place and decided, to set the parent of my camera myself with the AttachTo() function of USceneComponent.
The compiling of this code fails, because it can't convert from UCapsuleComponent* to USceneComponent*, but according to the Unreal Engine 4 Documentation:
Somewhere along the way UCapsuleComponent inherits from USceneComponent, so this should normally work right?
Note: The same code works, if I replace UCapsuleComponent with a USkeletalMeshComponent, by using GetMesh(), but doesn't deliver the desired results. (I will deactivate the mesh and it's children on camera Swap and both cameras have the relative location problem)
asked Jul 02 '17 at 02:09 PM in C++ Programming
Have you tried this?
If,i am not wrong then,AttachTo() function has been deprecated now. Also,make sure that,you have this header included.
Maybe,you are getting that conversion error because,you have not included CapsuleComponent.h header?
answered Jul 02 '17 at 02:41 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here