Add description for CFrame rotational data#28
Conversation
|
The issue with this is that some of those supposed half-floats are occasionally outside the required range of Thus, there are two possibilities: We would need to figure out how these numbers are actually encoded if we wanted to validate this theory. My instinct tells me that you are correct in that this is the format, but that these numbers are fixed point fractional parts and not float16s. |
|
this github comment section may be of interest: https://gist.github.com/StagPoint/bb7edf61c2e97ce54e3e4561627f6582
|
|
I think I'm getting some more insight - similar to the above github code, the largest index is stored as the first number. Examples:
This showcases that Roblox likely compresses floats to integers, with more or less precision being shifted for the floats based on the first index's size. |
What is this hex data of? Is this consistent among all samples? |
|
The hex data was taken from the Squash CFrame docs; I haven't gotten around to testing it across more samples due to personal issues. |
CFrames' rotational components are normalized when sent through remotes, as confirmed by sending a sample CFrame through a remote like so:
Since CFrames are orthnormalized, there end up only being three degrees of freedom instead of four; which means the fourth quaternion can be calculated through
w = sqrt(1 - x^2 - y^2 - z^2).This information was mainly based off of http://physicsforgames.blogspot.com/2010/03/quaternion-tricks.html, and is highly likely to be the implementation Roblox uses thanks to confirming the cframes' enforced orthogonality when passed through remotes.