Download

Paper 2D Documentation for 4.3 Preview

Hi Skeleton60,

Collision is not supported with flipbook components directly. However, in 4.5 you can author sockets in the frames and use those to attach other collision components like a box component in order to get animated collision with a flipbook.

Cheers,
Michael Noland

Hello,

I have some issues with collisions on my PaperCharacter .
The main character needs to crouch and to make positioning easier, I’ve set the pivot on all sprites to bottom center. Otherwise, with the pivot in the center, he will float while crouching.
However, since the root is a Capsule with the center on the pivot (and that can’t be changed), it will extend both up and down from the pivot, resulting in a collision that doesn’t match my character at all.
I also need to be able to change the collision to fit the shape of the character (e.g. smaller when crouching).

What would be the best way to deal with this?

I’ve checked the AnswerHub but didn’t find any clear solution:
https://answers.unrealengine.com/questions/78334/2d-top-down-collision-box-instead-of-capsule.html
https://answers.unrealengine.com/questions/56685/sprite2d-collision-in-blueprints.html
https://answers.unrealengine.com/questions/58229/undefined.html

Here are the options that I saw and/or explored:

  • Setting pivots on each sprite in a way that the bottom of the sprite will touch the bottom of the capsule: while this workaround seems the easiest to apply, it’s not very convenient.
  • Removing the capsule collision (to add a custom one):
  • Completely removing collisions on the capsule: is the capsule mandatory for some functions to work properly?
  • Making the capsule very small feels like a hack: if I set it to a very small size, I wonder if it will break its behaviour and, if I keep it to a reasonable size, my character will float a bit above the ground.
  • Adding a custom collision:
  • Adding a box component in the character with collision related flags: I haven’t managed to make the collision work.
  • Adding collisions on the sprites: same they don’t work.
  • Use the Pawn class for my character: I haven’t tried yet.
  • Making a custom C++ class with my own collision system: I haven’t looked into that yet.

I also haven’t understood the following answer, in the case that it would solve my issues, could you elaborate on the procedure?

So my question is: which path should I take to make collision works the way I would like?
I haven’t probed all of them but felt each had some flaws and would like some experienced opinion to avoid wasting time on a dead-end.
I’m aware that a lot of stuff is under development, and maybe I’d rather work on other aspects of my project at the moment.

Thanks for your answers!

So, I’m currently trying to use a Pawn as my main character.
The issues are that it has no physics or movement component. Most documentation or answers on the AnswerHub just say “make your own” without getting into details.
Can someone provide more detailed guidelines about how to do that?

So far, I’m moving my Pawn with something like that (just for testing, I make him move right all the time and put some fake gravity):

While my pawn moves, it doesn’t look like a very good solution.
The main issue is that collisions seem to be totally ignored, even though I added a Box component to my pawn with collision flags.
I suspect ‘Add Actor Local Offset’ ignores collisions and teleports the actor.
I saw someone mentioning ‘Move to location’ and another ‘Set Physics Linear Velocity’ but I didn’t manage to make those work.

Is it possible to add a physics component on a pawn?

Never mind, I got back to using PaperCharacter and the Crouch function seems to be good enough for my needs.
While using a Pawn worked in the end, it was more work to get to more or less the same result.
I’m still not sure I’m making the right choices though.

Did you get the pawn to work with collisions without using physics or do you mean you got just the rest to work? I’m guessing that was your problem, if a pawn nor the component it bumps into aren’t using physics it will not respond to collisions, only to overlaps. So to use a pawn with collisions you’d have to set your meshes to be physics actors. I’m worried that will cause slowdowns on mobile, and also makes you have to use forces for anything that moves.

I’m not even sure if you can make a physics actor fully static (for when a pawn bumps into a solid wall and you don’t want the wall to move) but maybe just settings the mass to something crazy high would work. It feels hacky though.

Yes, I added physics to get the collisions to work.
A consequence was that my pawn was bouncing after falling and hitting the floor. I suppose characters reset their velocity to 0 when they hit the ground to avoid that.
Without physics, I think it was only testing overlaps as you say.

EDIT:
Finally, I’m now creating my own pawn-derived class.

I too am having difficulty with collisions and Paper 2D. I see that you can setup custom hitboxes on the character via the sprite editor. How do I access those in C++?

Sprite->?

I’m kinda new to using Paper 2D and blueprints so bear with me. I can bring in my frames and animate them with flipbooks, and I’ve been able to animate and move the character on the screen. But what I’m wanting to do is to add in a third animation for an attack. I have the frames and flipbook set up, but I’m not too sure as to how to update the animation for those frames only. I use the InputAction node and set the flipbook to the right animation, but all it does is reset back to the idle or run animation.

Maybe I’m missing something that’s right in my face?

Also my apologies if this is supposed to be posted somewhere else.

Sprite->GetBodySetup() (note: this can return nullptr if there is no collision for a sprite), and then look at the AggGeom member.

Cheers,
Michael Noland

In general, I’d probably start another thread about this rather than being hidden in this old doc post that people might not check. How do you have it set up? If you are setting the idle/run animation every frame, but the jump animation only when a button is pressed, then the next frame the idle/run animation will ‘win out’. Instead you’d want to only set the idle or run animation if the player was not in the process of jumping.

Have a look at this tutorial, it might help out: Paper2D: Animation State Machine | 08 | v4.4 Tutorial Series | Unreal Engine - YouTube

Right now this state management for flipbooks is a bit more complicated than I’d like it to be, and long term I hope we can repurpose the same machinery for 3D anim blueprints to use with 2D characters.

Cheers,
Michael Noland

Venerable mister Nolan sir,

I have followed said tuts and come to a question that seems as though it has not been asked. If you could check this thread whenever you have time I would greatly appreciate it.

Danke.

As of 4.7, Paper2D documentation is now part of the main doc site Paper 2D | Unreal Engine Documentation so I’m going to get someone to unsticky this post.

Other useful resources include the series of Paper2D videos on YouTube and the Paper2D support stream (video here:https://www.youtube.com/watch?v=qWUEkTd2Xu8 , project can be downloaded from the learn tab in the launcher).

Cheers,
Michael Noland

Hello. I’m beginner in 2D. I read Paper2D doc. I have some questions. Where can I find docs about TileSet and TileMap? And tutorials how to use them?

This is a very good tutorial: Unreal Engine 4.7 - Paper 2D Creating and Editing Tilemaps

I know how to add collisions to the tilemap objects. I set collision boxes behind of tilemaps objects

Hi 8Observer8,

Yeah, that’s a good tutorial for 4.7. Most of the issues run into during that video have been addressed for 4.8, and there will also be official documentation on tile maps released when 4.8 is released. I’ll reply back here when the new docs are up.

Cheers,
Michael Noland

Please, make more tutorials about 2D for beginners. How to shoot, how to make level by tile maps and so on. We’re wait the updates. Thank you very much!

Alan Noon will be doing a stream on 2D next Tuesday. There’s no event thread for it up yet, but keep an eye out on the events forum. It should be at the same time as usual.

Cheers,
Michael Noland

Nice news! I will! Thanks!

Hello, i was just wondering if how or if it is possible o have a 2d topdown camera
where you can zoom in and zoom out without distorting the 2d flipbooks in the scene…
mine works fine with zoom in… it looks nice, but when i zoom out too much…
the flipbook sprites becomes too distorted…

I’m trying to achive same things like other 2d strategy games where i could zoom in and out…
theres dont seem to have any problems with zooming out…

Wonder what’s wrong with mine… i’m sure im lacking a lot of things in the scene or havent enabled settings…

So can we expect to see a video on how these new features work and the tools that have been added?