Esempio n. 1
0
        public Offset <DesiredPhysics> ToFlatBuffer(FlatBufferBuilder builder)
        {
            int locationOffset        = Location == null ? -1 : Location.ToFlatBuffer(builder).Value;
            int velocityOffset        = Velocity == null ? -1 : Velocity.ToFlatBuffer(builder).Value;
            int rotationOffset        = Rotation == null ? -1 : Rotation.ToFlatBuffer(builder).Value;
            int angularVelocityOffset = AngularVelocity == null ? -1 : AngularVelocity.ToFlatBuffer(builder).Value;

            DesiredPhysics.StartDesiredPhysics(builder);

            if (Location != null)
            {
                DesiredPhysics.AddLocation(builder, new Offset <Vector3Partial>(locationOffset));
            }

            if (Velocity != null)
            {
                DesiredPhysics.AddVelocity(builder, new Offset <Vector3Partial>(velocityOffset));
            }

            if (Rotation != null)
            {
                DesiredPhysics.AddRotation(builder, new Offset <RotatorPartial>(rotationOffset));
            }

            if (AngularVelocity != null)
            {
                DesiredPhysics.AddAngularVelocity(builder, new Offset <Vector3Partial>(angularVelocityOffset));
            }

            return(DesiredPhysics.EndDesiredPhysics(builder));
        }
 public static Offset <DesiredPhysics> ToFlatBuffer(this ObjectPhysics physics, FlatBufferBuilder builder)
 {
     DesiredPhysics.StartDesiredPhysics(builder);
     DesiredPhysics.AddLocation(builder, physics.Location.ToFlatBufferPartial(builder));
     DesiredPhysics.AddVelocity(builder, physics.Velocity.ToFlatBufferPartial(builder));
     DesiredPhysics.AddRotation(builder, physics.Rotation.ToFlatBuffer(builder));
     DesiredPhysics.AddAngularVelocity(builder, physics.AngularVelocity.ToFlatBufferPartial(builder));
     return(DesiredPhysics.EndDesiredPhysics(builder));
 }