Serial Com, casting a rotating object to an encoder



I need an urgent help!
Im using an encoder with Arduino to rotate an object in UE5.
Im using SerialCom plugin.

So far I get the postiion value when I simulate, but I cant make the object rotate, I think it has to do with the casting nodes, but I cannot find a right tutorial or resources online to apply for my case. Anyone has a solution for this?

big thank you

You have to plug this in, probably?

unfortunately not doing anything. i think i have to cast the rotating object in this bp?

You don’t need to cast any actors just to set their orientation.

However, I think it’s very unlikely that you will get exactly one full string of serial data per frame rendered, which is what your tick function currently expects.
Thus, you will end up with a bunch of empty strings, or maybe partial strings (depending on how the serial port plugin works, I don’t know) that may convert to 0 that may end up saying “there is no rotation.”

In general, when communicating over a serial port, you should think of it as the same as a network; it’s an asynchronous process that may or may not deliver 0, 1, or more events in any particular interval of time. Thus, you need to implement a loop that polls available data until there’s no more data to read, and then decodes that data as received, and if there’s a proper message/event received, dispatch as appropriate.

1 Like