What can I do to make a camera actor BP never possibly move left and only right?

The camera actor bp is being moved by a AddActorWorldOffset node. I want it to move Y+ or right and never possibly left or Y-. I want something to lock it down and it can only gain not subtract.

Any help is appreciated, thanks.

Hey @usa423!

What I would do, On begin play get the position of the camera Y and set that as a variable like “Y Threshold.” Then when it moves, clamp it using a Clamp(Float) node with the minimum set to the “Y Threshold”, and after it moves set the current Y value of the camera as the new “Y Threshold”.

Hope that helps!

1 Like

Another option is to add a world dynamic actor that applies a collision box next to the camera. When movement attempts left it gets blocked by the collision.

1 Like

It does, all things I have tried seem to alter the “smoothness” of the offset which I am trying to avoid. Ok will look into this method here.

Rev that could actually work if I got it right. It would have to be something, an actor with a big box collision set to block all, and then block everything attached to the camera actor. But then, this whole thing would have to move when the camera actor moved at the same time. Maybe then the key to this method is to use a different method of moving it. Perhaps use set actor location on this one INSTEAD of addactorworldoffset as the smoothness of this actor would not ultimately matter (out of sight out of mind), as long as it didn’t push or so something to the camera actor.

Separate world actor. Do not attach it. In the collision actor execute movement on Tick.

You’ll want to do sweeping movement vs teleport, so that it detects the collision of the cameras actor.

just imagine a wall that moves left to right along with the camera.

another option is to outright deny left input in the controller class or your function that moves the camera.

Enhanced input (Left/Right) outputs 1,0,-1 (Right, null, Left). Branch check for a positive ( > 0 ) → apply movement.

For the camera move function if independent from pawn movement you’d do the same check. If > 0 call function.

1 Like

I have something similar to that, a boolean called “facing right” for the players and it works out fairly good but still a few small quarks.

If you could only see how convoluted my camera actor blue prints get sometimes with attach walls and things hehe. It is what I use to hold the players in.

Let me ask you this, I have noticed sometimes I have to set floats with a Do Once node to get some looks Im after VS setting them with something fast firing like an Event Tick which does nothing. What is your opinion on this?

So far I have not got clamps to work out. I asked Rev this but I will ask you as well. When it comes to re setting this float, say on the other side of the addactorworldoffset node *which is being fed by event tick), would I need to use a do once for re setting that for this?

I never actually use Do Once in any of my projects. I’ve never had a need to and I’ve been working with UE on/off since to the 2.0 days and daily since 2016/7.

I tend to fully scope projects down to the individual actors and components. What each needs to do and how/what interactions with other classes there will be (dependencies etc). This helps me prevent gotchas where I have to either refactor a lot or crutch lean on an approach (less work). I think this is my main saving grace.

Overall if a Do Once is helping where Tick chokes it means the executions/logic relying on the variable are too slow. Variable is getting updated too fast to get the desired result.

I’d have to see the code, dependencies, and know exactly what the desired result would be to say anything about usage.

1 Like

Are you telling the camera to move every frame? If so you may want to have a branch checking for movement, for performance reasons. You could also wait until this is achieved then refine it.

It’s a little logic loop. It does not need a DoOnce for any reason. :slight_smile:

Start: Set Variable Y.
attempting to Move camera: False-> skip this function.
attempting to Move camera: True-> break Y for proposed movement, pass Y into clamp. Recombine vector, then move. If the proposed Y is lower than Variable Y, it will not move in Y.
finally, if current Y > Variable Y, Set current Y as Variable Y.

Why don’t you show us a pic of the code where you’re at? You might be just shy of it working!

1 Like

This only allows for Right movement input.

1 Like

I can only do that if you will check out the LAST thread I made before this one, so that you might have some context here, I also invite @Rev0verDrive and anyone else to check out that thread as well.

I appreciate you taking the time to make this Rev, thank you. But because the Camera Actor is just an actor BP and not a character BP, AMI will not work. :frowning: