AcousticAbsorption Support for PhysicalProperties

This commit is contained in:
phoriah
2025-10-21 01:24:34 +02:00
parent b21fffd693
commit 0ae48c5cc8

View File

@@ -569,11 +569,11 @@ Binary_Descriptors = {
["PhysicalProperties"] = function(raw) -- ? Not sure yet (https://github.com/RobloxAPI/spec/blob/master/properties/drafts/AttributesSerializeFull.md#physicalproperties)
local len = 1
if raw then
len += 20
len += 24
end
local b = buffer.create(len)
buffer.writeu8(b, 0, raw and 1 or 0)
buffer.writeu8(b, 0, raw and 3 or 0) -- 3 means it has set CustomPhysicalProperties & has set AcousticAbsorption
if raw then
buffer.writef32(b, 1, raw.Density)
@@ -581,6 +581,7 @@ Binary_Descriptors = {
buffer.writef32(b, 9, raw.Elasticity)
buffer.writef32(b, 13, raw.FrictionWeight)
buffer.writef32(b, 17, raw.ElasticityWeight)
buffer.writef32(b, 21, raw.AcousticAbsorption)
end
return b, len
@@ -886,6 +887,7 @@ XML_Descriptors = {
Elasticity
FrictionWeight
ElasticityWeight
AcousticAbsorption
The value of each component is represented by the text content formatted as a 32-bit floating point number (see float)
]]
@@ -893,7 +895,7 @@ XML_Descriptors = {
local CustomPhysics = "<CustomPhysics>" .. XML_Descriptors.bool(raw and true or false) .. "</CustomPhysics>"
return raw
and CustomPhysics .. "<Density>" .. raw.Density .. "</Density><Friction>" .. raw.Friction .. "</Friction><Elasticity>" .. raw.Elasticity .. "</Elasticity><FrictionWeight>" .. raw.FrictionWeight .. "</FrictionWeight><ElasticityWeight>" .. raw.ElasticityWeight .. "</ElasticityWeight>"
and CustomPhysics .. "<Density>" .. raw.Density .. "</Density><Friction>" .. raw.Friction .. "</Friction><Elasticity>" .. raw.Elasticity .. "</Elasticity><FrictionWeight>" .. raw.FrictionWeight .. "</FrictionWeight><ElasticityWeight>" .. raw.ElasticityWeight .. "</ElasticityWeight><AcousticAbsorption>" .. raw.AcousticAbsorption .. "</AcousticAbsorption>"
or CustomPhysics
end,
-- ProtectedString = function(raw) return tostring(raw), "ProtectedString" end,