Ejemplo n.º 1
0
        public override void OnConstruction(FTransform transform)
        {
            PrimaryActorTick.bCanEverTick = 1;

            var transformRules = new FAttachmentTransformRules(
                EAttachmentRule.SnapToTarget,
                EAttachmentRule.SnapToTarget,
                EAttachmentRule.SnapToTarget,
                false
                );

            _mesh = new UStaticMeshComponent(this, "mesh");
            _mesh.RegisterComponent();

            _mesh.AttachToComponent(GetRootComponent(), transformRules, "");

            _collider = new UBoxComponent(this, "collider");
            _collider.RegisterComponent();
            _collider.SetBoxExtent(new FVector(250, 250, 100), false);
            _collider.SetHiddenInGame(false);

            _collider.OnComponentBeginOverlap += Collider_OnComponentBeginOverlap;
            _collider.OnComponentEndOverlap   += Collider_OnComponentEndOverlap;

            _collider.AttachToComponent(_mesh, transformRules, "");
        }
Ejemplo n.º 2
0
        protected override void BeginPlay()
        {
            var transformRules = new FAttachmentTransformRules(
                EAttachmentRule.SnapToTarget,
                EAttachmentRule.SnapToTarget,
                EAttachmentRule.SnapToTarget,
                false
                );

            _mesh = new UStaticMeshComponent(this, "mesh");
            _mesh.RegisterComponent();

            _mesh.AttachToComponent(GetRootComponent(), transformRules, "");

            _collider = new UBoxComponent(this, "collider");
            _collider.RegisterComponent();
            _collider.SetBoxExtent(new FVector(250, 250, 100), false);
            _collider.SetHiddenInGame(false);

            _collider.OnComponentBeginOverlap += Collider_OnComponentBeginOverlap;
            _collider.OnComponentEndOverlap   += Collider_OnComponentEndOverlap;

            _collider.AttachToComponent(_mesh, transformRules, "");
        }