[Paper2D] Ignore the Z axis?

How would I go about making my entities ignore the Z-axis?

Disabling Gravity does nothing it seems.

I believe it is under your character movement component, scroll down to the Planar Movement section. If you enable Constrain to Plane and set the Plane Constraint Normal Z value to 1.0 your character never change its Z value. Assuming it’s a character

That didn’t quite do the trick.

I have this 2D game where I try to get around the gravity issue that pulls everything down on the Z-axis. This works alright, but to make it work I have to place my spaceship on a 2D plane which is then the “playingfield”.
But when I shoot the projectiles they immediately collide with the playing field. This makes sense as the 2D spaceship “lays” on top of it and the projectile is spawned on top of that plane as well.

But I thought that if I could life them off of the 2D plane just by a pixel, it would make the projectiles not collide with the playingfield.
To do this I had the idea of making sure that both the ship and projectile have a constant Z axis value that can’t change, effectively making it 2D (biggest issue for me in the Paper2D framework at the moment).

Sprite collision in Paper2D is a little wonky. It has to be done by more than 1 pixel offset. When I made my first 2D game, I had layered backgrounds (It was a platformer). In order to not get my character to collide with anything in any of the other layers, I had to separate them by at least 50 pixels. SO my game example again.

My far background is -500 on the y (Really far back to add more layers if needed.) then my playing field is at 0y. Then my water layers or any layers that are inf ront of the playing I had to put at at least 50 on the y to not get collision. Obviously I could have just turned collision off for the layers or whatnot, but using location was faster for lots of assets.

So maybe try more of an offset.

Also, for plane constraints, when making my 2d, to lock them so they could NOT move along the y plane I used the code :

GetCharacterMovement()->bConstrainToPlane = true;
GetCharacterMovement()->SetPlaneConstraintNormal(FVector(0.0f, -1.0f, 0.0f));

So when trying to constrain to Z try -1.0 instead of 1.0 as suggested above, as it may be the issue. The -1.0 on my y completely inhibits any movement on the y perfectly for me, so should work for you.

I tried to put -1 in the Z axis and all it did was make my spaceship invisible, until I click it in the editor during gameplay.
The projectiles stop as soon as they leave the ship and are also invisible until I mark them in the world outliner.

Setting the gravity to 0 did the trick for us in our project L.O.V.E. We have a vertical scrolling shooter, and our planar constraint is on the Y and set to 1. You may also want to be controlling your velocities, IE: setting the Z velocity to 0. I imagine with a top down, your Z is facing down, so you should probably lock your planar constraint to the Z, and also make sure you are setting gravity to 0 in your world settings.

With collisions, you have two options for controlling collisions.

  1. Make sure you are using custom collision channels under project settings, and utilizing them.
  2. You have a choice of ortho or perspective camera, for easy parallax scrolling, use perspective, and then scale up your background objects and drag them away from the camera.

I hope this helps a bit, we had to jump over these same hurdles when we worked on our game jam project.

Thanks for the info!
I’ll check it out and see if I can make it work.

I made a Horizontal Setup like the one you suggested. Though I can’t make my spaceship move as I want it to.]

This is the blueprint used to make it move up and down, but nothing happens when I press W or S.
However if I switch the world direction to X, the spaceship will go back and forth without a problem.

Something tells me that removing Gravity makes going up and down the Z axis impossible. Any thoughts?

Your attachment was invalid, but let me see if I can help anyhow:

I think you will get the gist of what I am doing. For the left and right, we use Add Input, and for up and down, we add velocity. We set the velocity for the Z axis to 0 when the up or down axis is not in use.

We also add input to the ship to match the input velocity of the camera. So it appears the ship is staying still while the camera is moving forward. Our trick it to make the camera a separate ‘Character’. This allows us to apply a velocity to the camera, and know exactly how fast it is moving.

Unfortunately, the blueprint was to big to get the whole thing in one shot, but I think you will get the idea.

Maybe you can see the picture now.

Well I got to a point where it now moves as I want it to. I moved the axis around so that I play along Y and X instead of X and Z.

But now I have a new issue with the Projectiles that I have not seen before. I put a Projectile Movement component on the Projectiles and set the same Planar constraints as the Spaceship.
But the Projectiles spawn and then fall to the ground instantly instead of flying along the X axis, even though it worked in a previous project.

As you can see they just stack up.