lo-th / Oimo.js

Lightweight 3d physics engine for javascript
http://lo-th.github.io/Oimo.js
MIT License
3.05k stars 301 forks source link

Extending Oimo shapes from outside #48

Open jagenjo opened 7 years ago

jagenjo commented 7 years ago

Hi:

I'm trying to adapt Oimo to my special needs for my application, that requires some new collision shapes. The problem is that Oimo do not allow to extend it easily without modifying the lib itself, because any collision detector must inherit from CollisionDetector but that class is not public so I cannot extend it without editing the lib, which will cause problems in future updates.

Also the world.add function allows to pass the shape as an string, but the possible values are hardcoded in a switch. I suggest to have a container to associate shape names with the class representing it.

I will make the changes myself but I dont feel confident enough yet.

Cheers