So i made a door that opens with E but it rotates in place 90 degree which is not how doors work obviously so how do i fix this
You have to place the pivot (the origin) of the door mesh to its side instead of its center. Rotating is always done around the pivot point (which I guess for you is in the center).
its a little bit more than that, they are rotating their root component which is basically just rotating the entire actor.
so to solve the issue only move the components that need moving, then as Kristofmorva said ensure that the origin of your component is in the correct location (bottom corner in this case). you can fake the origin by using a scene component then having the door be a child of the scene.
they do have a curious scripot setup for a door though, i wonder what the setting of a location variable is for and what else they are doing on update.
Ooops, sorry, I did not even see the other 2 images, only the 1 with the viewport, so I guessed the mesh component is being rotated (as it’s inside the frame and the frame does not need rotation).
I don’t know why aren’t the thumbnails of the other images visible.
I cant set the component in the bottom right as its a cube mesh and its in the middle so it gives the shape of the door and it was spawned in the viewport
What you can do is putting it under a Scene Component (which is in [0, 0, 0]), and place the door in a way that the bottom left corner of it will be also in [0, 0, 0].
Then, you can rotate this new Scene Component, and the door should rotate around it’s side.
thank you for answering but im not the smartest in ue4 so let me be honest with you im confused lol
i know whats a scene component but the other stuff confuses me
Just make a new Scene Component and place your door in it like this:
and then put the corner of the door to the origin:
Then, instead of rotating the mesh or the actor, you have to rotate this new SceneComponent (
DoorScene on my image).
If you placed it like this, then the pivot is not your problem anymore but the way you rotate. You have to be learn the basics for things to work, of course
Well, evidently there is an issue. Can you post your current BP?
now my door fling 90degree and then continues another 90degree and doesnt even close
the timeline is normal and nothing has an issue, i placed the scene and under it is the box and then the door this is the only thing that can cause the issue but i dont see anything else
the first and the last are the door related stuff and the other are just for the door to push the player if he is touching him which shouldn’t be the issue
it doesn’t open 90 degrees it jumps to 90 with no animation and then another 90 with animation which then clips through the wall and what do you mean i dont close it lol.
my biggest problem right now is it is not closing while spamming or holding or breaking the keyboard just clicking E
And what happens? Based on this, your door should turn 90 degrees when you press E, and when you press it again, it should jump back to zero, and open again ( so of course it’ll never be closed because you never close it )
One issue is surely, that you made your scene component the RootComponent, which is not what my image has shown. You need a new scene component, UNDER the root component.
And what I mean under you not closing the door is… you never close the door. When E is pressed, you rotate the door starting from 0 to 90. You never rotate from 90 to 0.
You need another timeline in the “B” part of FlipFlop, which goes from 90 to 0, and sets the rotation of the door (similarly to the other one)
so what should i do to close the door exactly? i tried connecting a branch with it and a float
i honestly don’t know what to tell you, thank you so much not only for helping but for sticking that long. Have a great day
sorry to bring you back but i made the timeline but now what?i copied everything to the new timeline but the door canceled the animation for both and i have to touch the door physically to open or close it