#[Tip] Making your field system Actor in cpp

9 messages · Page 1 of 1 (latest)

neat kettle
rotund marsh
#

[Tip] Making your field system Actor in cpp

prisma thicket
#

What is MFieldActorClass ?

neat kettle
#

E.g Ustaticcomponent object will be names as MCharacter mesh …. Some developers use it to distinguish member variables and temporary once

bright basin
#

Thank you very much for it. it's not difficult and much better than blueprinting

solid haven
#

I used the above screenshots to write this C++ implementation of the force field. Hopefully this will make it easier for somebody else who is trying to do the same.

#

In AWeapon::BeginPlay() I have this to create an instance:

    if (auto* pWorld = GetWorld()) {
        if (auto* pClass = AWeaponField::StaticClass()) {
            this->pFieldSystemActor = pWorld->SpawnActor<AWeaponField>(pClass);
            if (this->pFieldSystemActor) {
                this->pFieldSystemActor->AttachToActor(this,
                                                       FAttachmentTransformRules::SnapToTargetIncludingScale);
                this->pFieldSystemActor->SetOwner(this);
            }
        }
    }