Jump to content
  • Advertisement

SSmith

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

100 Neutral

About SSmith

  • Rank
    Newbie
  1. SSmith

    Collision methods?

    That has cleared everything up A LOT, I'm glad you also included that description on Epsilon, because I think that's something I've actually encountered previously, and I didn't think to fix it in such a way. And yes, by 'bounce' I just meant both moving instead of a single box, although I will have a look at restitution, because that will probably come in handy later! Thanks for all the help, especially the links! I've got a lot of reading to do!!! Everything is much, much clearer now! - Steve
  2. SSmith

    Collision methods?

    Thanks for the links AND code! Yeah, I'll have to read through them, I've taken a look at the N tutorials previously and they did seem to give a good overview but I was too tired to consider modifying them to be 3D. Also, when you use this line of code: [color=#1C2837][font=CourierNew, monospace][size=2][color=#000000]box1[color=#666600].[color=#000000]centre[color=#666600].[color=#000000]x [color=#666600]+=[color=#000000] [color=#666600]([color=#000000]x [color=#666600]/[color=#000000] [color=#006666]2[color=#666600])[color=#000000] [color=#666600]+[color=#000000] epsilon[color=#666600];[/font] [font=CourierNew, monospace][size=2] box2[color=#666600].[color=#000000]center[color=#666600].[color=#000000]x [color=#666600]+=[color=#000000] [color=#666600]([color=#000000]x [color=#666600]/[color=#000000] [color=#006666]2[color=#666600])[color=#000000] [color=#666600]+[color=#000000] epsilon[color=#666600];[/font] Would this be used to, for example, provide a more 'realistic' collision between two entities? E.g. If one entity collides with another, they both 'bounce' off one another? Thank you for taking the time to help! - Steve
  3. SSmith

    Collision methods?

    Does anyone know of any methods which actually fit in with the general concept of AABB's? At the moment the method I have above is really not very good, and I'd rather actually learn how AABB's should be done. - Steve
  4. SSmith

    Collision methods?

    Hi, at the moment I'm using a simple check I found from a page on the internet (I was using a custom one, but this one is much faster): public boolean checkCollision(BoundingBox boundingBox1, BoundingBox boundingBox2) { if(boundingBox1.min.x > boundingBox2.max.x) return false; if(boundingBox1.min.y > boundingBox2.max.y) return false; if(boundingBox1.min.z > boundingBox2.max.z) return false; if(boundingBox1.max.x < boundingBox2.min.x) return false; if(boundingBox1.max.y < boundingBox2.min.y) return false; if(boundingBox1.max.z < boundingBox2.min.z) return false; return true; } I've also got a self-written 'get intersect amount' method which does seem to work, but I'm not exactly sure how I'm supposed to actually use it effectively (without a rather inefficient and buggy algorithm which doesn't actually fit in with the general concept of AABB's), heres that method: public float AABBIntersectAmount(BoundingBox newPos, BoundingBox collisionObject, IntersectType dimension) { if (dimension == IntersectType.Intersect_X) if (newPos.centre.x > collisionObject.centre.x) return newPos.min.x - collisionObject.max.x; else return -(collisionObject.min.x - newPos.max.x); if (dimension == IntersectType.Intersect_Y) if (newPos.centre.y > collisionObject.centre.y) return newPos.min.y - collisionObject.max.y; else return -(collisionObject.min.y - newPos.max.y); if (dimension == IntersectType.Intersect_Z) if (newPos.centre.z > collisionObject.centre.z) return newPos.min.z - collisionObject.max.z; else return -(collisionObject.min.z - newPos.max.z); return 0; } (NewPos being the position of the player, and collisionObject being the BoundingBox of a tile, dimension is just an enum which can either be X, Y or Z). - Steve
  5. SSmith

    Collision methods?

    Hi Cornstalks, Thanks for your reply. Yeah, I kinda understand what you're talking about, but how would I check which face of the tile the entity is colliding with? For example, if I detected an intersection on the X axis, that also means the entity would technically be intersecting on the Z, too. So the resulting collision would be a little off :/ As for the looping part, that seems to be a good way of doing it, although I'm guessing that could be optimised by just only checking collisions with tiles in close proximity to the entity. And if you do have some links, I'd be very happy to read them, I'm trying to find everything I can on the subject!! - Steve
  6. SSmith

    Collision methods?

    This is my first post on gamedev, so excuse me if this is in the wrong forum. I've been a lurker for a while, but I've only just decided to sign up. I've been learning OpenGL for the past few weeks, and I've got a rather basic, but good, knowledge of the API for the most part. Obviously you can guess where this is going, I'm working on a voxel-based terrain engine (similar to Minecraft or Infiniminer, but more of a Real Time Strategy game concept instead of FPS). So far I've managed to achieve quite a few personal feats, for example I've managed to get the engine rendering 3.3 million cubes at around 200fps (obviously this is without complex AI or physics, just basic rendering right now). But this is where I hit a wall, I've done quite a bit of research into many collision methods, but I need a fast system, so I looked into AABB's and OBB's. For now I'm sticking with the AABB concept, as I just want the most basic of hit detection to be working, so I can continue with the more fun parts of development. I have created a BoundingBox class that detects intersections, so I'm half of the way there. But heres where the problem is, what do I do after detecting an intersection? For example, I've got an entity (we'll call this creature01), the entities AI tells it to move forward. So it's velocity.z is set to +0.1f , and it moves forward that amount. During this 'movement', I loop through all the tiles in the terrain, and I detect a collision with the bocks below, and to the front. Now what? If I've got a collision with the ground below (which could be any number of blocks in length, depending on how long the entity is) and a collision in it's path, how do I stop it from: 1. Falling through the ground, and 2. Moving through the tile in front? This is where most documents on Bounding Box's seem to end, or become overly complex and begin to just use Mathematical notation (I'm not exactly brilliant at understanding most of the equations I read). Thank you for reading my post! - Steve
  • 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!