{"action":"created","issue":{"url":"https://api.github.com/repos/EOUCS344Sp15/ReleaseTheKraken/issues/33","labels_url":"https://api.github.com/repos/EOUCS344Sp15/ReleaseTheKraken/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/EOUCS344Sp15/ReleaseTheKraken/issues/33/comments","events_url":"https://api.github.com/repos/EOUCS344Sp15/ReleaseTheKraken/issues/33/events","html_url":"https://github.com/EOUCS344Sp15/ReleaseTheKraken/issues/33","id":78316374,"number":33,"title":"How should collision be implemented?","user":{"login":"DBaird-EOU","id":12261912,"avatar_url":"https://avatars.githubusercontent.com/u/12261912?v=3","gravatar_id":"","url":"https://api.github.com/users/DBaird-EOU","html_url":"https://github.com/DBaird-EOU","followers_url":"https://api.github.com/users/DBaird-EOU/followers","following_url":"https://api.github.com/users/DBaird-EOU/following{/other_user}","gists_url":"https://api.github.com/users/DBaird-EOU/gists{/gist_id}","starred_url":"https://api.github.com/users/DBaird-EOU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DBaird-EOU/subscriptions","organizations_url":"https://api.github.com/users/DBaird-EOU/orgs","repos_url":"https://api.github.com/users/DBaird-EOU/repos","events_url":"https://api.github.com/users/DBaird-EOU/events{/privacy}","received_events_url":"https://api.github.com/users/DBaird-EOU/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/EOUCS344Sp15/ReleaseTheKraken/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-20T01:10:59Z","updated_at":"2015-05-21T01:17:53Z","closed_at":null,"body":"I was having difficulty implementing a rectangular hitbox based collision system.  The best I could get for collision detection was having every entity that has a hitbox checking for collisions with every other entity with a hitbox, which is O(n^2), which seems like a lot, but it might not be.  I also had issues trying to get entities that collide to not overlap, and be able to move away from each other.  What I did was in onUpdate(), I added the entity's velocity to its position, and then checked, for all other entities, if that caused a collision.  If it did, I reversed the velocity and added it to the position to move it back.  Currently, this is resulting in the entities getting stuck together.  Multiplying the velocity by 1.1 results in them getting pulled together when colliding, and multiplying by 1.2 results in them flying apart at high speed (which is pretty funny).  \r\n\r\nAfter that, I started thinking if it might be better to use Box2D instead, but that is kind of overkill for what we want to do in this game.  It would allow for some more features though, such as cannon balls transferring force to obstacles to push them, projectiles \"bouncing off\" a squishy jelly fish, rotation, rotational inertia, and more.  Obstacles could be \"pushed\" out of the way with excessive force, which would probably be funner than just attacking them.  The kraken could \"grab\" stuff (with Box2D joints), and fling them around.  Box2D would allow for better physics without the need to write any collision detection code, and it runs in native C++ code, which is faster than Java.  The downside is that due to the way it is set up, it would require a large refactor of how everything works.  This refactor would mostly effect world entity storage, entity interaction, and entity spawning.  Box2D would also make dealing with physics more difficult, due to the more advanced physics simulation.  Instead of just defining a rectangular hitbox, position, and velocity, you would have to define a simple or detailed collection of shapes to represent the hitbox, and set the mass, friction, restitution, position, velocity, and angular velocity.  Most of those can also be defined for each shape that makes up a hitbox.  \r\n\r\n#### So what do you guys think? \r\n\r\nShould we use Box2D (already made), with more advanced, harder to set up physics, or make our own system (not made yet) with simpler, easier to set up physics?\r\n\r\nThe Box2D libraries are already included in the project just in case we wanted to use it."},"comment":{"url":"https://api.github.com/repos/EOUCS344Sp15/ReleaseTheKraken/issues/comments/104087892","html_url":"https://github.com/EOUCS344Sp15/ReleaseTheKraken/issues/33#issuecomment-104087892","issue_url":"https://api.github.com/repos/EOUCS344Sp15/ReleaseTheKraken/issues/33","id":104087892,"user":{"login":"DBaird-EOU","id":12261912,"avatar_url":"https://avatars.githubusercontent.com/u/12261912?v=3","gravatar_id":"","url":"https://api.github.com/users/DBaird-EOU","html_url":"https://github.com/DBaird-EOU","followers_url":"https://api.github.com/users/DBaird-EOU/followers","following_url":"https://api.github.com/users/DBaird-EOU/following{/other_user}","gists_url":"https://api.github.com/users/DBaird-EOU/gists{/gist_id}","starred_url":"https://api.github.com/users/DBaird-EOU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DBaird-EOU/subscriptions","organizations_url":"https://api.github.com/users/DBaird-EOU/orgs","repos_url":"https://api.github.com/users/DBaird-EOU/repos","events_url":"https://api.github.com/users/DBaird-EOU/events{/privacy}","received_events_url":"https://api.github.com/users/DBaird-EOU/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T01:17:53Z","updated_at":"2015-05-21T01:17:53Z","body":"Yeah, I used it in my app too, and I kind of want to use it in this game.  I just wanted to see what everybody else thinks.  If we use Box2D, it is something that you would want to get started on as soon as possible."}}