Project: Paper2D

hi guys,

I have made request

idk what do you think about, I hope will have a look at it.

Any information about flipbook keeping sprite collision feature coming soon? can i hope for in 4.6 ? :o
[/QUOTE]

In 4.7, Paper2D flipbook components can now directly collide with other objects. Flipbook assets have a new Collision Source property that controls source of collision data for flipbook (if any), which can have following values:

  • NoCollision: flipbook has no collision
  • FirstFrameCollision: flipbook has non-animated collision based on first frame of animation
  • EachFrameCollision: flipbook changes collision each frame based on animation (Note: setting can be expensive as it requires recreating physics state every frame)

Note: In many cases it may make more sense to attach collision components (e.g., a box component) to a socket on flipbook component rather than directly generating collision from source frames, especially if you want some collision regions to overlap while others block.

Cheers,

Thanks for heads up, I’ve added these for 4.7 (/EpicGames/UnrealEngine/commit/b22ec814cfa5bc86dbf3d426cde5183705a1ceeb).

Cheers,

Should be in 4.7.

Improved collider support for terrain splines is being worked on right now. We’ve already branched for 4.7, so depending on when work is done and how risky it is it might or might not get merged into 4.7 release branch. You can access underlying spline using GetSplineComponent() on actor or AssociatedSpline on terrain component. Long term I’d like to merge two components together and remove need for wrapper actor, but at time I prototyped it spline component didn’t derive from PrimitiveComponent and so couldn’t render itself.

No updates right now; what you suggest is (I think) what I was planning on, allowing you to pick a nominal pixel size and it would compute aspect ratio padding / zoom to try to keep that to an integral multiple (e.g., author your game in 256x192 and that gets doubled or tripled and/or padded depending on screen size).

Cheers,

Replied in the other thread, but long story short is that support for multiple textures per sprite is planned for 4.8. It won’t be specifically for Android texture compression, but with a custom material that pulls RGB from first slot and A from second, it could certainly be used for that (as well as for normal-mapped sprites, complex materials that need a mask texture, etc…).

Note: You can work around now if your source assets are already atlased, you could create one material instance per atlas page that references separate alpha texture as a non-sprite texture sample. (You could even do it if they aren’t atlased, but you’d have a plethora of loose one-off materials that might be annoying to work with).

Cheers,

It’s substantially more expensive than not recreating physics state every frame, but it largely depends on number of sprites you have playing flipbooks. On your main character it shouldn’t be a big deal at all, and probably not on a few enemies (cost is still less than spawning a new enemy from scratch, for example), but it’d tank if you had hundreds or thousands of colliding flipbooks all playing at once. Use it where you need animated shapes, use another collision body attached to a socket where you just need to move shape around but not change it (updating transform is faster than recreating PhysX mirror), and use an enclosing capsule component or no collision at all if you don’t need it.

cost isn’t likely to go down any time soon, each frame is unrelated and could be totally different, so PhysX needs new info every time frame changes.

Cheers,

I’m not sure I follow. You can set pivot position in Texture Packer, and importer should respect that appropriately on created sprites, whether or not trim and rotate are enabled. If isn’t working correctly, please open an AnswerHub ticket with a repro case and we’ll get that fixed.

Cheers,

Hi Twiddle,

Thanks for PR, although I didn’t end up going down quite same route you proposed as mentioned in comments there. However, support for pulling collision from either first frame or each frame is 4.7 and main now in case you were interested.

Cheers,

Cool that you got it working. I’ve put in a feature request for runtime sprite generation (ala CustomMeshComponent allows for 3D meshes), though it’s currently backlogged.

Cheers,

Translucency sorting in UE4 is currently done on a per-component basis, rather than a per-mesh-batch basis, which means it’s not possibly to change sort priority/etc… for individual sections within a single component like a tile map render component. I’ve talked with rendering team about changing in future, but it’s not a high priority for them right now.

However, I do have some good news about sort key and sorting issues in general in 4.7, as there is now a project-wide setting to control how translucent objects are sorted during rendering. Translucent Sort Policy can be set on renderer project settings page or via r.TranslucentSortPolicy console variable, and can have following values:

  • Sort based on distance from camera centerpoint to bounding sphere centerpoint. (default, best for 3D games)
  • Sort based on post-projection Z distance to camera.
  • Sort based on projection onto a fixed axis. (best for 2D games)

third setting sorts based on projected distance along Y axis (PaperAxisZ), and should help significantly in making games that use translucent rather than masked sprites. It’s currently hard-coded to that axis right now, but sort axis will probably end up being project-configurable in future.

Cheers,

Thanks for :slight_smile:

I am now waiting for 4.7 :cool: christmas day :confused:

Thanks for updates !

Regarding to sprites collisions, I have found several issues with performance. For example question from some time ago

It would be useful to have a way of merging several spritecomponent collisions into a single physics body, then I guess overhead wouldn’t be that big.

At moment I’m using meshes for collisions and deactivating collisions in PaperSpriteComponent.

I did get it working but my target IOS couldn’t compile texture generation code and I haven’t went back to it yet. other issue was collisions: it still had collision of original sprite and I wasn’t sure how I could update collisions at runtime. So if and when does happen it be nice if collisions are considered too.

Hi,

I use an ortographic camera view and only Paper2D actors. When I deploy to device (android) sometimes I see z-fighting issues due to floating point precission. I only use y-axis for layering paper2d sprites (besides some simple 3d mesh like walls). I see z-fighting if sprites are close enough (setting a sprite on Y = 1.0 and other in Y = 2.0 can experiment z-fighting).

A workaround is to set a distance in Y-axis enough to avoid z-fighting issues but I do not like approach, since game being a 2D game I should not have any problem.

Ideally I would like to define a camera frustrum with a depth low enough for puting all my 2D objects without z-fighting issues.

How can I do ?
Thanks

is posted in answerhub aswel

Just type “sort” in details panel with an actor selected or at components tab inside a blueprint(with flipbook selected).There set translucent sort priority number starting from zero and adding one as you move to foreground . will solve all of your problems hopefully!

umm but it isn’t a translucency problem (or shouldn’t be) !

If you have even one translucent sprite in your game then it must be.
But you are talking about android so I don’t really know.

But there are not translucent sprites involved in my issue. If I put a masked sprite at Z = 1.0 and other one at Z = 2.0 then they can result in z-fighting … and what I want is to avoid collision on sceneario, since even with a 16bit depth buffer I can have 65k layers…

On PC I do not see issue happening, my guess is depth buffer is larger in PC (maybe 32 or 24bit) I could enforce a larger depth buffer for android in project settings but I don’t think its cleanest way of avoiding issue.

Do you have plans to implement XY view for 2d games? If yes when do you plan to do it?

i would like to ask for a small favor. Is it possible to see fixed soon ?Flipbook collisions do not work with custom collision channels - World Creation - Epic Developer Community Forums

I was SUPER excited to finally see flip book collisions inside Unreal and i wanted to work hard to implement them in my game during these holidays, but unfortunately bug has prevented me from doing anything with them for almost 20 days now which is a bummer .If it is an easy fix could you pleeeease do something about it so i can work weekend? :o

I would also like to bring to you attention as well Trigger volumes do not trigger - Feedback & Requests - Epic Developer Community Forums .
I do not know if is a paper2d specific (but just in case it is i am letting you know about it), but combination of both of them has left my game in ruins.
Thank you.