Orthographic Parallax

I’m currently trying to make a parallax background in my Paper2D game but having some difficulty.

I found a blueprint that I thought I could modify to achieve what I want.
http://puu.sh/g12p5/5886a5fee5.png

I can’t seem to be able to get it to do what I want though, am I going about this all wrong? The blueprint I posted follows the player, for parallax I need it to follow the player but slowly let the player get further away from it. Any help is greatly appreciated.

I understand the basic logic of how this should work but not how to implement it.

+1 need something for render all front group of sprites in orthographic camera mode and back group in parallax(perspective), need something like hybrid camera

Are you just using a perspective camera for your game? Or are you using 2 cameras, orthographic for foreground and perspective for background?

Spent all day trying to wrap my head around this and think I came up with a pretty decent method. I’ll leave this here for anybody who finds it looking for solutions.

Now I just need to grab my camera’s velocity instead of my characters velocity, because it can look a little weird sometimes with the camera lag (easing) I have on. Does anyone know how to do this? I can’t seem to reference it.

A visual of that would be much appreciated, I attempted to follow but ran into a few errors.

My camera is attached to my character. It’s not showing up in the get all actors of class node. Is there somewhere else I have to expose it?

I can’t seem to reference it in anyway sadly. Tried getting it in mycharacter blueprint and copying and pasting it but I get errors. I’ve tried getting it through a reference to my character as well but nothing seems to work.

I’m trying to access it from a blueprint other than my character blueprint.

Ohh I think I figured out the problem. I assumed it wasn’t working because Get Component Velocity was just returning 0 0 0. I’m guessing it’s giving velocity relative to the blueprint that it’s in… Is there anyway I can get it’s world velocity?

EDIT: Just did this test within the character blueprint http://puu.sh/g2t19/3fbd5d059b.jpg

It just outputs 0 0 0 so I think the problem might be Get Component Velocity.

Why use velocity when you can just relate to the current world location? Using velocity will cause drifting during runtime. Maybe I have misunderstood the thread. I did a quick test and you should be able to parallax your background by a formula similar to this:


if (LayerDistance != 0 && ParallaxStrength != 0)
{
  ParallaxLayer.locationXY = Camera.locationXY / (LayerDistance * ParallaxStrength);
}

ParallaxStrength is only a scalar to increase overall parallax. Distance could either be a static number or fetched from your depth axis. (for example Z) This formula will decrease the distance travelled the further away the layer is. The layer in this case would simply be a transform with multiple children.

I probably had some oversight or missed something crucial, but I can’t see why it would be more complex than this. If it is, please enlighten me. :slight_smile:

Thank you for the suggestion. This is what I made attempting to follow your pseudo code. It is very buggy and I need to add to the Z location somewhere along the line. Where did I go wrong?

http://puu.sh/g2wqm/a17af6f9c3.png

Realized a big mistake I was making, it no longer flickers, but It doesn’t seem to move, messing around with the parallax strength right now.

EDIT: Oh scratch that! It works, just had to mess around with the numbers more. Thank you everyone for the help! This method seems to be the best. :slight_smile:

I’m glad you got it working. :slight_smile: