Farama-Foundation / Miniworld

Simple and easily configurable 3D FPS-game-like environments for reinforcement learning
http://miniworld.farama.org/
Apache License 2.0
700 stars 131 forks source link

Add collision function #67

Closed Zachary19980701 closed 2 years ago

Zachary19980701 commented 2 years ago

Thanks for your contribution. In my project I need to implement collision effect. I now do this by comparing the coordinates of the anchor with the coordinates of the wall. I would like to ask if there is a better way to do it, maybe I can make a contribution to this library.

Zachary19980701 commented 2 years ago

I add collision function in miniworld.py file to achieve this function

    def collision(self, ent0, min_x, max_x, min_z, max_z):
        if ent0.pos[0]>min_x and ent0.pos[0]<max_x and ent0.pos[2]>min_y and ent0.pos[2]<max_y:
            return True
        else:
            return False
pseudo-rnd-thoughts commented 2 years ago

Would you be able to make a PR to add this feature?

Zachary19980701 commented 2 years ago

I will add this feature in future work