Here is the code and very simple. I can see the object in the blue print and has nothing except the object itself. so all the issue should be on the C++ code.

class APiramidShootingProjectile : public AActor

    /** Sphere collision component */
    UPROPERTY(VisibleDefaultsOnly, Category=Projectile)
    class USphereComponent* CollisionComp;

    /** Projectile movement component */
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = "true"))
    class UProjectileMovementComponent* ProjectileMovement;


    /** called when projectile hits something */
    void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);

    /** Returns CollisionComp subobject **/
    FORCEINLINE class USphereComponent* GetCollisionComp() const { return CollisionComp; }
    /** Returns ProjectileMovement subobject **/
    FORCEINLINE class UProjectileMovementComponent* GetProjectileMovement() const { return ProjectileMovement; }


and the C++ (without the hit portion)

/*  SetRemoteRoleForBackwardsCompat(ROLE_SimulatedProxy);
    bReplicates = true;
    // Use a sphere as a simple collision representation
    CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
    CollisionComp->OnComponentHit.AddDynamic(this, &APiramidShootingProjectile::OnHit);     // set up a notification for when this component hits something blocking

    // Players can't walk on it
    CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f));
    CollisionComp->CanCharacterStepUpOn = ECB_No;

    // Set as root component
    RootComponent = CollisionComp;

    // Use a ProjectileMovementComponent to govern this projectile's movement
    ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
    ProjectileMovement->UpdatedComponent = CollisionComp;
    ProjectileMovement->InitialSpeed = 3000.f;
    ProjectileMovement->MaxSpeed = 3000.f;
    ProjectileMovement->bRotationFollowsVelocity = true;
    ProjectileMovement->bShouldBounce = true;

    // Die after 3 seconds by default
    InitialLifeSpan = 1000.0f;

    //For Multiplayer
    //bReplicates = true;

so here all that should be shown is created, but nothing shows, even so when i aim something the hit function works and works as it should, so really not understanding what its happening. I am new to this and extremely frustrated so please answer as soon as possible.

  • \$\begingroup\$ I don't see where you add visual components (e.g. a mesh) to the projectile. Collision itself provides physics only, no visuals. \$\endgroup\$ Mar 24, 2021 at 15:24
  • \$\begingroup\$ thanks that was the problem, i noticed that it was easier to do it by the BL and solvedi t that way \$\endgroup\$ Apr 5, 2021 at 0:40


You must log in to answer this question.

Browse other questions tagged .