I’ve just been doing some testing and have noticed that when Location (or i’m guessing any vector) is replicated to clients, it rounds down the decimal point.
Doesn’t anyone know if there’s a way to disable this rounding? Cheers
1 Like
I’ve found some info on the wiki that explains why this rounding occurs:
Value compressionedit ]
As mentioned in the section about relevance, the engine has a few tricks to reduce the amount of data it needs to send. One of these tricks is that it compresses certain value types for transfer and uncompressing them. This compression is not lossless, but actually changes the value that arrives at the client. This doesn’t apply to basic types, but only to certain structs:
Vector The components are rounded to the nearest integer and send as integer data. This way small vectors only require several bits up to a few bytes, while the original three uncompressed float values would have required 12 bytes. If you need more than integer precision, you should multiply the vector by a scalar value before assigning it to the replicated variable.
Rotator Only bits 9 to 16 of the components are transfered, which corresponds to the operation C & 0xff00. That way the required data amount is reduced from 12 to about 3 bytes. (It seems zero components even only take up a single bit, reducing the minimum size to 3 bits for the zero rotator.) The compression restricts replicated rotator values to rotations and makes them useless for rotation rates. To replicate a rotation rate, you could copy the rotator components to the components of a vector variable. Note that you shouldn’t use typecasting to vector because that results in a unit vectors, which not only discards the Roll component entirely, but also is heavily affected by vector compression.
For my purpose I will have to create two extra replicated fields for the actors that I want precise values for and have them replicate separately.
1 Like
simon_ze
(simon_ze)
February 25, 2024, 8:42pm
3
I had the same issue that the vectors were rounded for location. I found in the details panel for the blueprint that you can change “Replicated Movement” (Location/Velocity/Rotation) from “Round whole number” to “Round one decimal” and “Round two decimals”. This worked for me!
1 Like