Destroy a component at a given index
| 177 | |
| 178 | // Destroy a component at a given index |
| 179 | void BodyComponents::destroyComponent(uint32 index) { |
| 180 | |
| 181 | Components::destroyComponent(index); |
| 182 | |
| 183 | assert(mMapEntityToComponentIndex[mBodiesEntities[index]] == index); |
| 184 | |
| 185 | mMapEntityToComponentIndex.remove(mBodiesEntities[index]); |
| 186 | |
| 187 | mBodiesEntities[index].~Entity(); |
| 188 | mBodies[index] = nullptr; |
| 189 | mColliders[index].~Array<Entity>(); |
| 190 | mUserData[index] = nullptr; |
| 191 | } |