

サポート終了通知: 2026 年 5 月 20 日に、 AWS は のサポートを終了します AWS SimSpace Weaver。2026 年 5 月 20 日以降、 SimSpace Weaver コンソールまたは SimSpace Weaver リソースにアクセスできなくなります。詳細については、[AWS SimSpace Weaver 「サポート終了](https://docs.aws.amazon.com/simspaceweaver/latest/userguide/simspaceweaver-end-of-support.html)」を参照してください。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# エンティティの位置をロードする
<a name="working-with_app-sdk_ent_load-position"></a>

整数データ構造を使用してエンティティの位置をロードする (ステートファブリックから読み取る) ことができます。以下の例では、以下の関数を使用します。

**注記**  
以下の例に示すように、`Api::BuiltinTypeId::Vector3F32` から `Api::LoadEntityIndexKey()` を指定する必要があります。

**Example 配列を使用して位置を表す例**  

```
Result<void> GetEntityPosition(Api::Entity& entity, 
    Transaction& transaction)
{
    std::int8_t* dest = nullptr;
    
    WEAVERRUNTIME_TRY(Aws::WeaverRuntime::Api::LoadEntityIndexKey(
        transaction,
        entity,
        Api::BuiltinTypeIdToTypeId(
            Aws::WeaverRuntime::Api::BuiltinTypeId::Vector3F32),
        &dest));
        
    std::array<float, 3> position = 
        *reinterpret_cast<std::array<float, 3>*>(dest);
}
```

**Example struct を使用して位置を表す例**  

```
struct Position 
{struct
   float x;
   float y;
   float z;
};

Result<void> GetEntityPosition(Api::Entity& entity, Transaction& transaction)
{
    std::int8_t* dest = nullptr;
    
    WEAVERRUNTIME_TRY(Aws::WeaverRuntime::Api::LoadEntityIndexKey(
        transaction,
        entity,
        Api::BuiltinTypeIdToTypeId(
            Aws::WeaverRuntime::Api::BuiltinTypeId::Vector3F32),
        &dest));
        
    Position position = *reinterpret_cast<Position*>(dest);
}
```