@@ -213,7 +213,7 @@ public class UpdatePosition : Message {
213213 public uint object_id ;
214214 public uint flags ;
215215 public Position position ;
216- public Vector3 velocity = new Vector3 ( ) ;
216+ public Vector3 velocity ;
217217 public uint placement_id ;
218218 public bool has_contact ;
219219 public ushort instance_timestamp ;
@@ -243,9 +243,7 @@ public static UpdatePosition read(BinaryReader binaryReader) {
243243 newObj . position . frame . cache ( ) ;
244244
245245 if ( ( newObj . flags & 0x1 ) != 0 ) {
246- newObj . velocity . x = binaryReader . ReadSingle ( ) ;
247- newObj . velocity . y = binaryReader . ReadSingle ( ) ;
248- newObj . velocity . z = binaryReader . ReadSingle ( ) ;
246+ newObj . velocity = Vector3 . read ( binaryReader ) ;
249247 }
250248
251249 if ( ( newObj . flags & 0x2 ) != 0 ) {
@@ -269,8 +267,12 @@ public override void contributeToTreeView(TreeView treeView) {
269267 rootNode . Nodes . Add ( "flags = " + flags ) ;
270268 TreeNode positionNode = rootNode . Nodes . Add ( "position = " ) ;
271269 position . contributeToTreeNode ( positionNode ) ;
272- rootNode . Nodes . Add ( "velocity = " + velocity ) ;
273- rootNode . Nodes . Add ( "placement_id = " + placement_id ) ;
270+ if ( ( flags & 0x1 ) != 0 ) {
271+ rootNode . Nodes . Add ( "velocity = " + velocity ) ;
272+ }
273+ if ( ( flags & 0x2 ) != 0 ) {
274+ rootNode . Nodes . Add ( "placement_id = " + placement_id ) ;
275+ }
274276 rootNode . Nodes . Add ( "has_contact = " + has_contact ) ;
275277 rootNode . Nodes . Add ( "instance_timestamp = " + instance_timestamp ) ;
276278 rootNode . Nodes . Add ( "position_timestamp = " + position_timestamp ) ;
0 commit comments