How Would Enemy Tanks Be Implemented?

In this video, our Tank class inherits BasePawn, and we give it a camera. Then we change the BP_PawnTank to inherit our Tank class. If I were to add tanks as enemies, would they still need a camera and spring arm? If I plan on implementing this, should I make a new class called PlayerTank to inherit Tank and get the camera functionality, and put the camera and spring arm in there? And then I assume enemy tanks will keep a lot of the same functions that we will eventually be adding to our Tank class(Moving, Rotation, Firing, Hp) and have a new EnemyTank class to reference Tank?

They wouldn’t need one, no.

Though I don’t recall any example project from Epic where the AI character (if it had one) differed in that regard so I don’t think those two would specifically be an issue of having per se. (e.g. using ATank to inherit from which would have those).

That would be wasting sizeof(void*) * 2 for each enemy tank though as they won’t be used, so with sizeof(void*) == 64 that would be about 12KB for 100 enemy tanks so not exactly worth deterring away from that if doing that makes it easier for you.

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

Privacy & Terms