Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

267 Neutral

About BUnzaga

  • Rank
  1. BUnzaga

    Ammo.js Collision Separation

    Well I went with what I posted above, only instead of handling the callback during the collision iteration, I handle it afterward, because removing the rigidbody in the middle of iterating them was causing the browser to lock up   Here is what I ended up with for those of you who are interested in Ammo.js and this topic.  Please, if someone knows a better way, let me know.   Demo: https://goote.ch/d3a10e52808241ada183928d966fadd8.project (webGL).   Code: for(var key in AmmoUtil.collision){ if(AmmoUtil.collision.hasOwnProperty(key)){ AmmoUtil.collision[key].separated ++; } } var dp = this.dispatcher; for(var i = 0, ilen = dp.getNumManifolds(); i < ilen; i++){ var manifold = dp.getManifoldByIndexInternal(i); var num_contacts = manifold.getNumContacts(); if(num_contacts === 0){ continue; } var bodyA = AmmoUtil.rigidBodies[manifold.getBody0()]; var bodyB = AmmoUtil.rigidBodies[manifold.getBody1()]; for (var j = 0; j < num_contacts; j++){ var pt = manifold.getContactPoint(j); if(pt.getDistance() < 0.0){ var colID = bodyA.entity.id+"_"+bodyB.entity.id; if(AmmoUtil.collision[colID] === undefined){ pt.getPositionWorldOnA(pvec); pt.getPositionWorldOnB(pvec2); var normalOnB = pt.get_m_normalWorldOnB(); var pointOnA = new goo.Vector3(pvec.x(), pvec.y(), pvec.z()); var pointOnB = new goo.Vector3(pvec2.x(), pvec2.y(), pvec2.z()); var normalOnB = new goo.Vector3(normalOnB.x(), normalOnB.y(), normalOnB.z()); var info = { first:true, entityA:bodyA.entity, entityB:bodyB.entity, dataA:{other:bodyB.entity, pointA:pointOnA, pointB:pointOnB, normal:normalOnB}, dataB:{other:bodyA.entity, pointA:pointOnB, pointB:pointOnA, normal:normalOnB}}; AmmoUtil.collision[colID] = info; } AmmoUtil.collision[colID].separated = 0; break; } } } for(var key in AmmoUtil.collision){ if(AmmoUtil.collision.hasOwnProperty(key)){ if(true === AmmoUtil.collision[key].first){ AmmoUtil.collision[key].first = false; var entA = AmmoUtil.collision[key].entityA; if(entA){ var rbc = entA.getComponent('RigidBodyComponent'); if(rbc){ if(rbc.collisionBegin){ rbc.collisionBegin(AmmoUtil.collision[key].dataA); } } } var entB = AmmoUtil.collision[key].entityB; if(entB){ var rbc = entB.getComponent('RigidBodyComponent'); if(rbc){ if(rbc.collisionBegin){ rbc.collisionBegin(AmmoUtil.collision[key].dataB); } } } } else{ if(AmmoUtil.collision[key].separated > 1){ var entA = AmmoUtil.collision[key].entityA; var entB = AmmoUtil.collision[key].entityB; if(entA){ var rbc = entA.getComponent("RigidBodyComponent"); if(rbc){ if(rbc.collisionEnd){ rbc.collisionEnd(entB); } } } if(entB){ var rbc = entB.getComponent("RigidBodyComponent"); if(rbc){ if(rbc.collisionEnd){ rbc.collisionEnd(entA); } } } delete AmmoUtil.collision[key]; } } } }
  2. I'm using Ammo.js with the Goo webGL engine, and I'm working on trying to get triggers implemented, but I'm having some struggle finding a 'good' way to handle collision separation.   Here is a jsFiddle which shows how to handle collision starting:   http://jsfiddle.net/ajd7vd1o/   I'm also planning to implement a 'callback' type thing like this:   http://gamedev.stackexchange.com/questions/22442/how-get-collision-callback-of-two-specific-objects-using-bullet-physics   So when one object collides with another, it will pass in some collision info.   The problem I am having, is figuring out a good way to handle the separation, when the two previously colliding objects are no longer colliding.   Supposedly, there are gContactProcessed and gContactDestroyed callbacks which I could tap into, but I don't think these are currently possible.   http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Collision_Callbacks_and_Triggers   So I'm reaching out, before I start from scratch creating my own functionality, to see how other people have handled this.   Here is my main idea:   1. Have a map of collisions. 2. At the start of each pass, set a boolean value for all current collisions to false. 3. The fist time a collision is added to the map, trigger the onCollisionBegin callback, with the data from the collision. 4. During the collision check, if two objects are still colliding, set their boolean value to true. 5. For each collision in the map, if their boolean value is still false, trigger the onCollisionEnd callback and remove it from the map.   Does something like this seem good?  Are there any current implementations of Ammo.js with collision separation mechanics that I can look at?   Thank you in advance!
  3. BUnzaga

    MiniMORPG Feature Analysis Draft 2.0

    I don't like the fatigue idea 100%. I think the users should slowly have their fatigue drained as they adventure, and as their fatigue goes down, they suffer a penalty, but going back to town and visiting the local inn, or tavern for a few mins. should restore their fatigue. By forcing your users to take a 'time out' you are basically limiting the time they can play your game. I guess this is more directed toward 'power gamers', but if any company charged a monthly fee, and then dictated how often I could play, wouldn't have my subscription. Why discourage people from playing your game for long periods of time? Secondly the Log out/PvP system sounds like it needs a little re-work. No one is going to want to bust their ass getting good loot and objects, just to have some snow blower come and steal it from them while they are logged off. The rest of the game concepts sound pretty good. I especially like the underworld concept. I have a similar concept for my own ambitions.
  4. BUnzaga

    Structure of the MMORPG Workshop

    I've got a web site that I'm sort of wasting if you want to use it. I can create an FTP account (or whatever) for you to give you access. I have no clue if it would be of any use, its through hostmonster, so check out the features I have and let me know if you want to use it. hostMonster features I am in support of your goal, even though I am really new to programming, I am sure I would learn a lot from you, so I'll give you access to whatever you need, just not access to the actual account stuff. The actual page is www.BUnzaga.com I haven't updated it in a couple months.
  5. BUnzaga

    Game Design Decisions

    I am brand new to programming, so I am sure you might have already thought about this, especially since you are more of a tools developer, but I was thinking a good starting point is the world editor. I will be the first to say I have no clue what the proper or best steps are to create a project of this kind of scale, even a miniature version of it. I was just thinking about the various tutorials and posts I have read, and with my own minimal experience, it has always been, build an engine, create a level, figure out how to export and import levels, create a level editor (at least for tile based games). Obviously you will need models and art to go into the game, but from a programming perspective, that is what I would do. Thanks for doing this project by the way jwalsh. I wrote a great post to your beginner topic, and before I could click reply, my washing machine kicked on and I had a brown out, so my system restarted. Anyway, I'll be following you step by step, while I do my tutorials, read my book, and go to school (CS major). BUnzaga
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!