TamlWrite not saving setTrackedObject() to output file?
by Chase Webb · in Torque 2D Beginner · 05/30/2014 (10:34 pm) · 2 replies
Hey again! I have another TamlWrite related bug, and hopefully this one is just as simple as the last to fix.
A quick refresher: If you attach the following code to an object, such as the Point Force Controller, it sets its position based on the location of that object, as opposed to the actual scene's X Y coordinates:
Therefore, if it's attached to a sprite located at (for example) the position (-10, 17) it will appear at (-10,17), although it will consider that point to be (0,0).
When writing to an outputted Taml file, however, it only writes the position (0,0), so when you load the scene from that taml file it will appear in the wrong location. Here is an example of what my file saved:
Additional note: While as far as I can tell object IDs are not saved to the Taml file either, the sprite that this Point Force Controller is attached to does contain the following code:
Not the controllers attached to the object do have an ID listed there, though this does not affect how the controller is positioned when the Taml file is loaded.
Thanks to anyone who can help!
A quick refresher: If you attach the following code to an object, such as the Point Force Controller, it sets its position based on the location of that object, as opposed to the actual scene's X Y coordinates:
%controller.setTrackedObject( %object );
Therefore, if it's attached to a sprite located at (for example) the position (-10, 17) it will appear at (-10,17), although it will consider that point to be (0,0).
When writing to an outputted Taml file, however, it only writes the position (0,0), so when you load the scene from that taml file it will appear in the wrong location. Here is an example of what my file saved:
<PointForceController TamlId="1" Position="0 0" Radius="3" Force="25" NonLinear="0" LinearDrag="0" AngularDrag="0" />
Additional note: While as far as I can tell object IDs are not saved to the Taml file either, the sprite that this Point Force Controller is attached to does contain the following code:
]<Sprite
class="BallTarget"
SceneLayer="20"
SceneGroup="1"
Size="6 6"
Position="-10 17"
BodyType="Static"
CollisionGroups="2"
DefaultRestitution="1"
CollisionCallback="1"
Image="@asset=ToyAssets:Gems"
Frame="58"
BuoyancyController="1135"
cshapeindex="0"
PointForceController="1134">
<Sprite.CollisionShapes>
<Circle
Sensor="1"
Radius="0.1" />
</Sprite.CollisionShapes>
</Sprite>Not the controllers attached to the object do have an ID listed there, though this does not affect how the controller is positioned when the Taml file is loaded.
Thanks to anyone who can help!
#2
06/03/2014 (3:54 am)
Thanks Simon! Unfortunately I didn't have a quick test module ready for this one. :/
Associate Simon Love