BoxRunGame

@DanM

Hey When I Try To Add An Actor From Details Tab Its Not Working Also Giving Me An Error
Capture2

Error:

also I Faced this error in building escape while setting the PlatformTrigger From Details Tab

Why This Is Happening???
Please Help!!!

Where are you doing this? The blueprint or in the world?

1 Like

@DanM
I am Doing This In Blueprint

Then that would be why. The blueprint isn’t an instance in the world, it can’t reference things like that.

1 Like

I’m not sure how you’re using either of these things so I can’t really tell you how I would go about it.

1 Like

@DanM

Hey I Wanna Do Some Thing , Like If BP_Block(Actor) Hit With ABoxPawn(Pawn) Then We Will Do SomeThing But Unable To Set The BP_Block

Probably won’t be able to do this today.

1 Like

@DanM
Hey, I Fixed The Issue
Then You Said :

Thats Really Helped Me To Fix This, I Did The Same Thing In World Instead Of Blueprint And Everything is Fine Now.
Thanks For That :stuck_out_tongue_winking_eye:

Now I am Getting New Issue Like, In That Project I Added URadialForceComponent To The BP_Block , It Is Working For All Physics Body But For Pawn Its Not Working!!!
Please Help Me !!!

==============================================================

Setup:

So I’m a little confused. What are you expecting to happen? When is this radial force supposed to be applied? I’m not seeing any uses of it.

Also for components you want Visible not Edit for the UPROPERTY, you’re not editing the component itself but the properties on that component.

1 Like

@DanM

I Want When Pawn Hit On BP_Block Then The Force Will Apply

Block.cpp

void ABlock::Trigger()
{
	Force->FireImpulse();

	UGameplayStatics::ApplyRadialDamage(
		this,
		BaseDamage,
		GetActorLocation(),
		Force->Radius,
		UDamageType::StaticClass(),
		TArray<AActor*>()
	);
}

BoxPawn.cpp

void ABoxPawn::OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor,
	UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
{
	for (auto Block : BlockToTrigger)
	{
		if (!Block) return;

		if (Block->GetRootComponent() == OtherActor->GetRootComponent())
		{
			Block->Trigger();
		}
	}
}

I Followed Same Thing AS In BattleTank ->> Projectile

Objects your RadialForceComponent affects:

2020-04-23 19_47_24-BoxRun - Unreal Editor

The collision preset (and thus object type) of your pawn mesh:

2020-04-23 19_50_07-BoxRun - Unreal Editor


Considering BlockToTriger can only be applied on an instance you should probably be using EditInstanceOnly not Anywhere.

Also wouldn’t it make more sense for the block to be firing the impluse?

1 Like

@DanM
Thanks, I Really Missed That One, Now That’s Working ,

Yeap! I Thought After We Hit, A Force Will Apply, But Force Is Applying Before Hit, How That Worked In BattleTank >> Projectile ??? , :thinking:


And Can You Tell Me I Want Something Like ->> Consider BP_Block Has A Sphere Component, Now If Pawn Overlaps With That Sphere Component Then BP_Block Will Come Towards The Pawn.- How To Build The System?

Disable auto activate

You basically already have that but with OnHit, use on OnComponentBeginOverlap instead.

1 Like

@DanM
Thanks Dude,

Aaa , Actually I Was Wondering, Coin Will Move Towards The Pawn, Ok Have A Look ::

*** My System Currently : ***

  1. I Made A Rotating Coin ,
  2. When Pawn Overlaps , A Force Will Apply To The Coin Of Pawn’s Direction
  3. When Coin Hit With Pawn , Destroy

*** Is There Better Way ? ***

  • How Can I Make Rotation Better?
  • How Can I Make “Coin Will Move Towards The Pawn” In Another way? Cause In Current Situation If Coin Hits With The Pawn Then Pawn Is splashing Behind.

GitHub Project (Updated)

  1. I have just learnt that there’s already a component for this
    https://docs.unrealengine.com/en-US/API/Runtime/Engine/GameFramework/URotatingMovementComponent/index.html
  2. Not sure what you mean.
1 Like

@DanM

I Mean , If You Increase The Radius Of The Sphere Then The Velocity Of Coin Will Increase Also And Will Effect On Pawn And Will Push It Behind

vid.zip (688.7 KB)

Can You Tell Me Is There Any Better Way To Make Move The Coin Towards The Pawn?

void ACoin::Overlaps(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	auto Pawn = Cast<ABoxPawn>(OtherActor);
	if (Pawn)
	{
		auto CoinLocation = GetActorLocation();
		auto ActorLocation = Pawn->GetActorLocation();
		auto Direction = ActorLocation - CoinLocation;
		Force = FVector(Direction * ForceAmount);	
		
		MeshComp->AddForce(Force, NAME_None, true);
	}
}

Well if you’re just wanting it to be a pickup which has the magnet effect. Do you need to simulate physics?

Could you not just check if the Pawn is overlapping and then use VInterpTo and use SetActorLocation?

1 Like

@DanM
Thank You Very Much,
Hey I am Stuck Here, In Terms Of Casting I Know How To Cast A Pawn And GameMode ,
But Can You Tell Me How Can I Cast An Actor In Another Actor Or in GameMode ??

Not sure what you mean?

1 Like

@DanM

Suppose I Have An Actor Called (ATile) And I Wanna Cast() This In GameMode.cpp Then What Can I Do?
Like:

void ABoxRunGameModeBase::SpawnTile()
{
	ATile* MasterTile = Cast<ATile>(/*?????? */);
	if (!MasterTile) 
	{ 
		UE_LOG(LogTemp, Warning, TEXT(" Noooo "))
		return;
	}
}

Privacy & Terms