Well, Completly forgetting the TSubClassof mechanics

I simply added a UChildActorComponent. Not sure if there is any performance difference in doing so, but it wasn’t very complicated like he warned in previous lectures, instead all I did was cast it in my firing method just like we did in Blueprints.

void AWaypointMan::FireWeapon() {
	if (!ChildRef_Gun->GetChildActor()) { return; }
	auto GunActor = Cast<AGun>(ChildRef_Gun->GetChildActor());
	if (!GunActor) { return; }

I also didn’t attach my camera to the capsule component, like he did in the lecture, and didn’t run into any problems.

(The muzzle temp on there is just a backup location for firing but it is not utilized.)

Actually I have run into one problem. When I try to change the length of my spring arm (in blueprints), to achieve a 3rd person effect, The camera/spring arm gets positioned on the floor. Not sure why changing the length should do this, unless its losing its parent socket of the mesh’s head that I attached it to and then glitching out… But when I press the button to toggle back to first person, the first person looks ok; it is very odd.

I also tried parenting it to the capsule component like in the video to no avail.

It is a UPROPERTY(EditAnywhere), so I shouldn’t have a problem modifying its public values.

Ugh now my compiler keeps complaining I’m using an undefined class when I try to forward declare AGun then define it by casting. No clue why its complaining… Might just revert to the video’s version. Otherwise I cant fetch its animation instance from the mesh.

omg F*** me it was because it wasn’t a pointer.

All works now even the anim instance fetching. But i have to fetch it on begin play. Hopefully this won’t cause a problem in later videos.

Still not sure why the target arm length isn’t working. Perhaps I can switch to a different camera instead of modifying the current one in the future. This part shouldn’t have to do with the child actor decision since the functionality is unrelated.

Privacy & Terms