[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.

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.

http://puu.sh/ho7zM/86593dc158.png]

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?

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.

386a5a177b2eab48092a4ecb2c8eefc4be22ee02.jpeg

As you can see they just stack up.