Rotating static mesh deppendant on direction its moving

Hello im new to unreal engine i did a few courses and i feel like doing them does not help me progress so im doing my first project and i cant figure out this.
Im making a chair AI that will be chasing me with a person sitting on it but i cant figure out how to make legs and wheels of the chair to turn in realistic and make wheels and legs rotate deppending where its moving , right now all meshes rotating at the same time for me .

1 Like

There are 3 important things you’ll need to develop and understanding for here:

  1. Component hierarchy ( currently there is none )

  2. Relative rotation and rotation direction

  3. How to use ‘look at rotation’

1 is a matter of organizing the components and connecting them as they would actually be in real life. So the wheels would be parented to the legs, and the legs to the base. But the seat would be independent of the base etc. This means that when you move the parent mesh, all the child components move with it.

2 Is not easy to explain in writing like this, but for instance, how you code the wheel rotation would really depend on the orientation of the pivot point of the wheel mesh.

3 The node ‘look at rotation’ can be used to point the X axis of a mesh at an object in the world. But the code often needs tweaking from the default because you don’t want the whole mesh to orient itself to the player, just the Z of the legs, here would be an example.

Does that give you something to go on?

Thanks i’ll try looking into it and will come back when i have more questions or when im done with these 3 steps.

1 Like

okay i think i did what you said and now i made chair legs to always look at my character im thinking of making legs look at me only when AI sees me and i dont know how to make legs move lets say when AI is free roaming where should i target them then, maybe the start location ? Btw i centered pivot so its looking good .

The chair has the AI? Then I would target in the direction it is moving. So either target or forward vector.

Yeah it has ai :DDD i will mount character model onto it it wont look that dumb :smiley:

1 Like

this how i did it , now i tested and it looks like its rotating deppending on the forward velocity , is this way good or will it be performance issue ? By the way how could i make legs rotate slower what node could do that ?

1 Like

No performance issue.

Instead of just setting the rotation, use finterp, it will smooth things out

im sorry i watched the video and its a bit unclear how to put that finterp in my blueprint , i tried to just put finterp node instead of find look at rotation tried adjusting speed but didnt see any result actually.

You keep what you have now, but instead of just plugging the lookat into the set rotation node, you plug it into an finterp, and then into the Z.

The finterp takes the current rotation, the rotation you want, and delta ( from the tick node ) :slight_smile:

I’m not saying this is the ultimate solution, but it is the ‘interp’ version of what you have there

thanks it did work it looks way smoother now, sorry for asking so much

1 Like

I dont know if i should create another post or i can ask in this one about a different issue im having.
Im trying to make player be able to move camera to sides , up and down while he is hiding in closet, when he enters the closet moving camera around does not work im adding 2 codes that im using


It might be best to ask this on a new thread.

Partly because I usually avoid character movement questions, they can be a total minefield :rofl:

If you want to know which way I would head, it would be using a separate camera. That way, you don’t have any conflict between the character control and the camera control.

You can spawn a blueprint with a camera in, and set its position to be the same as the current camera.

1 Like

i actually have another camera spawned in and using it as a reference for a smooth transition when getting in closet camera switches to the camera inside smoothly , thank you for the tip ill make another post maybe someone has an idea why its not working :smiley:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.