SDLPP: don't colide with self

This commit is contained in:
zv0n 2023-03-10 16:45:10 +01:00
parent c453c2fe9a
commit fd96a1c2cc

View File

@ -119,6 +119,9 @@ Scene::getCollisions( RenderObject &r ) {
return {}; return {};
std::vector< std::pair< uint64_t, std::shared_ptr< RenderObject > > > ret{}; std::vector< std::pair< uint64_t, std::shared_ptr< RenderObject > > > ret{};
for ( const auto &x : collision_objects ) { for ( const auto &x : collision_objects ) {
if(x.get() == &r) {
continue;
}
for ( auto id : r.colidesWith( *x ) ) { for ( auto id : r.colidesWith( *x ) ) {
ret.emplace_back( id, x ); ret.emplace_back( id, x );
} }