I’m trying to create a door system that open with the mouse. If I drag the mouse to the right the door open, and to the left, the door closes. However, I’m finding it difficult to limit how much the door can be opened/closed in degrees.
For this door system I’m working with a min/max values to open/close the door at min 0º and max 120º.
For example, if I take the BP_Door and place it on the map, it will work just fine, because if I turn 30º it will be 30º. But, If I place the door but it’s a little rotated, to fit the map design, the door will already start at, let’s say, 70º. If I then apply the min/max degree it would be min 70º and max 190º.
This is where it gets tricky, because when i rotate past 180º it becomes negative. It’s even difficulty to do it If want to enable it to open to one side only. So I’m checking wich side I’m on and adding/subtracting any given degree on the door.
So, is there a way to always assume that the starting point is 0º? instead of the rotation the item has when placed on the map?
One thing I noticed is that even when the Door is placed on the map, sometimes it has the slightest degree deviation and it becomes -179.999578 (or something like this) and the whole system stop working.