コード例 #1
0
    public void RequestCreateObj(int frame, string path, Vector3 pos, Quaternion rotation)
    {
        /*
         * var builder = new FlatBufferBuilder(1);
         * CreateObj.StartCreateObj(builder);
         * CreateObj.AddPath(builder, builder.CreateString(path));
         * CreateObj.AddPos(builder, Vec3.CreateVec3(builder, pos.x, pos.y, pos.z));
         * CreateObj.AddRot(builder, Quat.CreateQuat(builder, rotation.x, rotation.y, rotation.z, rotation.w));
         * var vec = CreateObj.EndCreateObj(builder);
         * builder.Finish(vec.Value);
         * var dataBuffer = builder.DataBuffer;
         * */
        var msg = MsgCreateObj.CreateBuilder()
                  .SetPath(path)
                  .SetPos(Vec3.CreateBuilder().SetX(pos.x).SetY(pos.y).SetZ(pos.z).Build())
                  .SetRot(Quat.CreateBuilder().SetX(rotation.x).SetY(rotation.y).SetZ(rotation.z).SetW(rotation.w)).Build();

        Request(MessageType.CreateObj, frame, msg);
    }