x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Door rotating in place when i try to open it

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

alt text

Product Version: UE 4.21
Tags:
1.png (290.4 kB)
2.png (179.4 kB)
3.png (318.4 kB)
more ▼

asked Jan 16 '19 at 10:14 AM in Using UE4

avatar image

bradhrad
18 1 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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).

more ▼

answered Jan 16 '19 at 12:44 PM

avatar image

KristofMorva
1.1k 4 5 7

avatar image ThompsonN13 Jan 16 '19 at 02:25 PM

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.

avatar image KristofMorva Jan 16 '19 at 02:45 PM

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.

avatar image bradhrad Jan 16 '19 at 03:21 PM

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

avatar image KristofMorva Jan 16 '19 at 03:24 PM

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.

avatar image bradhrad Jan 16 '19 at 03:26 PM

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

avatar image KristofMorva Jan 16 '19 at 03:36 PM

Just make a new Scene Component and place your door in it like this:

Scene Component

and then put the corner of the door to the origin:

Viewport

Then, instead of rotating the mesh or the actor, you have to rotate this new SceneComponent (`DoorScene` on my image).

scene.png (2.9 kB)
door.png (424.2 kB)
avatar image bradhrad Jan 16 '19 at 04:09 PM

now my door fling 90degree and then continues another 90degree and doesnt even close

avatar image KristofMorva Jan 16 '19 at 04:17 PM

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 :)

avatar image bradhrad Jan 16 '19 at 04:20 PM

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

avatar image KristofMorva Jan 16 '19 at 04:22 PM

Well, evidently there is an issue. Can you post your current BP?

avatar image bradhrad Jan 16 '19 at 04:27 PM

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

alt text

1.png (312.6 kB)
2.png (313.0 kB)
3.png (261.8 kB)
4.png (271.2 kB)
5.png (348.5 kB)
avatar image KristofMorva Jan 16 '19 at 04:31 PM

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 :D )

avatar image bradhrad Jan 16 '19 at 04:33 PM

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

avatar image KristofMorva Jan 16 '19 at 04:38 PM

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.

avatar image bradhrad Jan 16 '19 at 04:41 PM

so what should i do to close the door exactly? i tried connecting a branch with it and a float

avatar image KristofMorva Jan 16 '19 at 04:46 PM

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)

avatar image bradhrad Jan 16 '19 at 04:48 PM

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

avatar image KristofMorva Jan 16 '19 at 04:51 PM

Hope it'll work, you too! ;)

avatar image bradhrad Jan 16 '19 at 05:04 PM

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

avatar image KristofMorva Jan 16 '19 at 05:07 PM

Can you show me the current graph? Also, try to disable temporarily the player pushing and other things which might interfere with the door.

avatar image bradhrad Jan 16 '19 at 05:11 PM

and just to make sure in the time line the time is 0 and 90 and the other is 1 second or whatever and 0 yeah?

alt text

7.png (334.4 kB)
avatar image KristofMorva Jan 16 '19 at 05:13 PM

You forgot to connect the Update pin to the SetRotation node for the second timeline.

Both timelines need to be 1 second (or whatever) long, opening should go from 0 to 90, closing (bottom timeline) should go from 90 to 0.

avatar image bradhrad Jan 16 '19 at 05:19 PM

so it opens normally but to close it i have to physically harase the door to close then 0 animation occur

avatar image KristofMorva Jan 16 '19 at 05:25 PM

You have to physically touch the door to close? Are you sure nothing blocks it? Try settings its collision to NoCollision while testing it out.

avatar image bradhrad Jan 16 '19 at 05:26 PM

i did and still i have to no clip through it to close Hey look dude you can just go if you want i mean you answered the question so thank you and ill try solving this problem on my own. Thanks

avatar image KristofMorva Jan 16 '19 at 05:29 PM

Some other code or setting interferes with the rotation then. Sure thing, hope you find it fast!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question