Component Local Rotation

I have searched for local rotation problem but none of the answers helped me in this situation.

I have created a door blueprint which rotates based on my mouse input when I grab it and works with physicsconstraint when I let it go. I have limited door’s rotation between 0 - 170 degrees using blueprint(the doorBP checks doorBP’s rotation if it is less than beginning rotation(the rotation value when I put doorBP in the editor) it sets the rotation to the beggining rotation, and same for the max rotation). Everything works great when I put doorBP with z axis 0 degree rotation. But if I put it under some degree other than z axis 0, door goes through 180 which then becomes -180 to 0 rotation values. And it makes my min limit of 0 useless. Because when it passes 180 it becomes negative value which is smaller than 0 offcourse. My blueprint components are made under this hierarchy:

[ROOT]Box1

–PhysicsConstraint1

–Door

–Handle

So my question is is there any workaround for local rotation. I have tried relative rotation but it still adds rotation of its parent to the component when I grab the door.

Little note: What I want is to rotate the door relative to its parent, like door component should be 0 even if its parent(Box1) is rotated. If possible :slight_smile:

A NOTE TO DEVS IF THEY SEE THIS QUESTION:
First thank you all for this great engine. Afterall there are many people having problem with current rotation system like 0 180 -180 0 circle and not having quaternions in blueprint. We just need some solid solution to all of these.

Hey Nicat-

You may want to try getting the z rotation of the door when you put it in the level (in the construction script) and then rather than control the rotation from 0-170 you could do from the starting rotation to (starting rotation + 170).

Thank you for answer. But that is what I have done exactly. It works if the door is placed under 0 z rotation. If I rotate the door in the editor ex. 90 degrees, and I try to open it ingame the z rotation value will have to go up till 90+170 which is 260. That is the time problem starts, we can’t have anything above 179.999 rotation. After 179.999 it starts as -179.999 and goes up untill 0. So 260 will be -100. And when it is negative my limiter starts thinking that door is below the permitted level and resets its rotation to minimum available. I hope I could explain my problem.

When you rotate the parent (Box1) are you doing so inside the blueprint or in the editor? Another method to control the door would be to use a timeline and Lerp node to play a smooth transition between it’s open and close position.

I do it in the editor to fit the door to the wall. I know the timeline method but what I am trying to accomplish is to be able to open/close door by grabbing and pushing/pulling it, like Amnesia but better :P. I am trying something else know, I think I am very close to the solution about the door. But still if you have any idea about making child component calculate rotation not world based but its parent based it would be great. Which I thought the relative rotation should do but didn’t. Thank you for taking time to help.

It’s my understanding that the door is rotating from 0-170 degrees and when Box1 is rotated, that rotation is being added to the door. So if Box1 is rotated to 30 degrees along the z axis then the door is rotating from 30-200 degrees. Is this the behavior you’re seeing? If so what happens if you subtract out the z rotation of Box1 when calculating the door’s total rotation? If the z-rotation for Box1 is greater than 0 then you would need to subtract it from the door rotation and if the rotation is less than 0 then it would need to be added instead. This should “zero out” the Door rotation to always assume it is reading from 0-170.

I think I have tried that one too, but will again try and let you know. I have forgotten which ways I have tried as there are tons of ways which I have tried already :slight_smile: Thank you again for help.

Also I have noticed some interesting thing. I use trace line and look at the door, then get the rotation of hit component and it is 0 no matter of the rotation of Box1. But if I grab the door and let it go the rotation of door resets to the rotation of Box1.

I tried It. I think there is some bug or something. Very paranormal stuff happens with my door :smiley: In order to debug it one needs to have an alien brain or something. Absolutely ununderstandable. At first it shows the doors rotation -89.9… then when I click on it it becomes 0. And goes to -89 rotation in subtracted rotation but it is at 0 rotation at realty. Awww… This is getting messed up totally… I can’t even describe what is going on… I have used my brain in last 2 days more than I have used it in my entire life :\

Ok I’ll continue trying untill I find it out. You may stop looking at this if you want. No offence :slight_smile: I will let you know if I figure this out if you want. Anyways really thank you for trying.

Hi again. Finally I made it. I just did the most dirty method possible. Configured min and max limits for 0, 90, ±179, -90 degree rotated positions of doors manually. And figured out every possible error one by one and prevented them. Now I have ‘vermicelli soup’ in my door blueprint :smiley: