How to limit the value of add local offset

I am making a crane that can be extended/retracted, but I want to limit how much it can be extended/retracted, so the tubes wont fall out of it’s parent tube, please let me know how to do so.

I have attached my blueprint on how to control the extension of the tubes, its a stupid method that I came up with, feel free to correct me if there are simpler and better way to do that as well, thanks a lot.

Edit: I’ve posted this before my first comment, but it went through moderation queue and appeared only now, so sorry for double. But I think I can leave this as an answer too.

The best solution depends on the rest of your system, but the first thing you can try is to use the [Clamp][1] node before the Delta Location Z inputs:

This way you can limit your offset for both negative and positive values, using the Min/Max inputs.

Try something like this:

You could add a conditional branch, and check if the offset is less of the max-offset value then the crane extends when the user gives the input, otherwise if the crane offset is >= of the max-offset value then nothing happens.
You could use variables to set these values or just use float/int nodes.

Why not use set local offset and use a clamp node?

Might work. Counterquestion to you: what if a component is driven by force, not by functions? Is there a way to limit its movement other than by putting a blocking volume where it should stop?


BTW, @jasoncwf, you can create blocking volumes one for each tube, and tick the sweep box when offsetting. It will require setting different collision presets for different tubes.

For the forces you can look at physics constraints. They allow you to set linear offset limits.

Thank you. That really did the job limiting a component’s movement.

Thank you very much, I will give it a try when I have the chance :slight_smile:

Thank you very much, I will give it a try when I have the chance :slight_smile: