Download

Need help with clamping door rotations

Hello!
I got a blueprint door system that allows me to rotate a door using mouse input (InputAxisTurn). I want to achieve similar to the doors in the game Amnesia where you open and close the door based on your mouse movement.
Thus far i am Linetracing my door BP and from there i rotate the door using InputAxisTurn as an rotation input. While i am rotating the door my ordinary mouse input look is locked while i am holding down right button to rotate the door.

This works good, but i want to take it a step further and limit the doors rotation to become more realistic (now it got inifinite rotation) and want to limit it to like 90 degrees one way.
I am completely stuck now and i am wondering if you guys have any tips or help for this?

Linetrace part 01
blueprint04.jpg

Linetrace part 02
b3754464548084f9f53e0af359e69188f4ba521e.jpeg

MouseInput
35a0e1a091cc1f518ab6f13bd9ed38293711e23f.jpeg

MouseInput to rotate door function
blueprint02.jpg

Not sure which one would be best for you but nodes that would do something like what you want should be,

Clamp Angle (or Clamp float)
FInterpEaseInOut
MapRangeClamped
Timeline (feeding in your float angle value instead of time and make a curve with ease in/out)

Yeah i tried with the clamp angle but i havn’t really figured it out yet because of the mouseinput as rotation.
Thanks for the answer!

I tried the timeline type now and i update the “New Time” with mouse movement and it keeps updating when i move my mouse as it is executin the “Set New Time”.

The problem i got now is that whenever i dont move the mouse the value becomes 0 and that resets the animation to time 0 as it floats up and down depending on movement. Anyone got any idea for this fix?

You said that it mostly worked, so without having gone through all your blueprint bits I wouldv’e thought you could just do this?
Did you try that?
604480ae79de44ddc46058822f681d9e9e683a12.png

EDIT: Or wait a minute that might not work, are you grabbing the old rotation of the door and ADDING the new Rot with your combineRotators?
Then you could maybe try breaking the last rotator resulting from that and clamp angle there?

I would have a maxYawRotation variable on the door that is exposed and defaulted to let’s say 90. Then on the opening of the door, if the current Yaw rotation is not at the originalYaw of the door + the maxYawRotation, continue opening the door.

Otherwise, don’t.

just a thought, but have you considered just putting a very small collision box as a door stop in your scene? i know its not what you are asking for code-wise, but it would be s solution to the door issue.

That sort of worked, i can now open the door up to 90 degrees and it stops at every step of the animation. Problem now is that i havnt figured out how to close the door again, i can rotate it up but it wont rotate it negatively so it cant be closed at the moment.

Yeah i tried that before, my animation is all based on a timeline so i guess it wont care about collision against solid objects then, the door goes through it when i open using that way.

Break the door rotation then add the yaws together and then clamp(float) the result and then make rotator

Anyone know if it is possible to have the timeline go from a negative time value to a positive? I want to be able to close the door but havnt managed to figue it out yet.