-
Notifications
You must be signed in to change notification settings - Fork 7
Entity.ReferenceObjectData
Entity.ReferenceObjectData contains almost every object in the scene.
Here's an example.
<instance guid="AA482FFD-6E18-4768-A5E4-ECD66B8FA039" type="Entity.ReferenceObjectData">
<array name="Components" />
<field name="Enumeration">2341</field>
<field name="Name" />
<complex name="Transform">3.42285417787e-08/0/0.999999880791/*zero*/0/1.0/0/*zero*/-0.999999880791/0/3.42285417787e-08/*zero*/-213.526580811/27.3136520386/14.0031290054/*zero*</complex>
<field ref="objects/vietnam/buildings/nam_temple_01/nam_temple_01/82991c9f-c81f-4667-98bf-024c17259070" name="ReferencedObject" />
<array name="ObjectSets" />
<array name="VisualTransformModifiers" />
<field ref="null" name="MeshShaderSet" />
<field ref="null" name="PhysicsMaterialSet" />
<field name="OverrideScreenAreaCulling">false</field>
<field name="IsInObjectSet">false</field>
</instance>
Let's go over the lines that make sense.
<instance guid="AA482FFD-6E18-4768-A5E4-ECD66B8FA039" type="Entity.ReferenceObjectData">
GUID is the unique ID of the object. It's making it possible to reference exactly this object. It has to be unique or Frostbite will complain. Just keep that in mind.
<complex name="Transform">3.42285417787e-08/0/0.999999880791/*zero*/0/1.0/0/*zero*/-0.999999880791/0/3.42285417787e-08/*zero*/-213.526580811/27.3136520386/14.0031290054/*zero*</complex>
These vectors contain all the position and rotation data. It's always listed as Vector3.Left, Vector3.Up, Vector3.Forward and position. The weird thing is that frostbite will do xyz backwards, so for all vectors in this line, we're doing zxy instead. Here's how it should look in the unity engine:
Vector3 instRight = Vector3.Right(0.999999880791/0/3.42285417787e-08) * -1; // Makes it inverse.
Vector3 instUp = Vector3.Up(0,1.0,0);
Vector3 instForward = Vector3.Forward(3.42285417787e-08/0/-0.999999880791);
Vector3 instPos = Vector3(14.0031290054/27.3136520386/-213.526580811);
When we start working on editing, we will need to find a way to allow the user to change this easily.
<field ref="objects/vietnam/buildings/nam_temple_01/nam_temple_01/82991c9f-c81f-4667-98bf-024c17259070" name="ReferencedObject" />
This is the actual model we're loading. We simply strip away the GUID in order to find the actual model name. Simple stuff.
We're actually not touching the rest of the instance yet. The wiki will be updated once/if we ever do.