Download

Paper2D Collisions

**Smash Like Game
C++
Paper 2D
Unreal 4.5
**
Alright, I think I am misunderstanding a few things.

Right now, I can set up collision boxes on the sprites (kudos for multiple polygons), so this is my first question.

  • We have >6400+ frames of animation. Is there any way in the matrix editor to copy those polygons across all frames? I know I will have to do a little adjusting, but it would save tons of time.

Now, I notice that we can setup both coliision boxes, and there is already a collision capsule component.

  • Why? Why can’t I just use the collision we are setting up on the animation frames for environmental collision? I assume this has something to do with root transform, and the fact that the collision may not be perfect across frames.
  • Which collision setup is used as the hitbox in a fighting game?
  • Do I create additional polygons in the sprite editor for the attack boxes as well? IE: I have the hitbox setup, and then they are punching. Do I setup a hitbox on their fist as well? How do I differentiate in the code?

Also, one more weird question. How do I create “bottom up” hollow bottom platforms. IE: You jump under it or at it from the side, and there is no collision. If you land on it, you, well, land on it. In something like Game Maker, I would just check vpseed and position relative to a platform parent.

I don’t want to do this in blueprints, but rather, I want to code the solution into the fighter base, and somehow assign our various bottom up platforms with a tag or something that can be recognized upon collision with the player. A trigger volume will not work here, this is for multiple players fighting at the same time. Does anyone have an idea.

I am grateful for any time saving help! Thanks everyone, and thank you Unreal for giving us a solution after our last engine turned on us.

So, to extend on my question. I decided to start somewhere with this. I figured I would just do custom collision events for my hollow bottom platform. So I opened my sprite, and turned off blocking events for collision, and switched them to overlap, problem is, the player still blocks. Even when every collision event is ticked to ‘ignore’ my character is still blocked by the platform.

dfbf53e1d0e61dfb7edf7ee07a4e3b7397feea47.png

Alright, for anyone having trouble with this. This setting only works if you use the sprite in a blueprint. It won’t work just as a sprite. So the next question:

How do I make my base character class return what it’s capsule is colliding with? What bit of code do I need?

I haven’t tested this yet, but for future searches, this is from the programming tutorial. I believe if you are using 3D collisions, this will work fine, however, it doesn’t answer how to implement the 2D hitboxes set on each sprite. This is only for the root capsule component. I really need this answered, as it is crucial for our platform fighter.


void ACodeTutCharacter::CollectBatteries() {
	float BatteryPower = 0.f;

	TArray<AActor*> CollectedActors;
	CollectionSphere->GetOverlappingActors(CollectedActors);

	for (int32 iCollected = 0; iCollected < CollectedActors.Num(); ++iCollected){
		ABatteryPickup* const TestBattery = Cast<ABatteryPickup>(CollectedActors[iCollected]);

		if (TestBattery && !TestBattery->IsPendingKill() && TestBattery->bIsActive) {
			BatteryPower = BatteryPower + TestBattery->PowerLevel;
			TestBattery->bIsActive = false;
			TestBattery->OnPickedUp();
		}
	}

	if (BatteryPower > 0.f) {
		PowerUp(BatteryPower);
	}
}

Did you ever find a solution?