Tag Info

Hot answers tagged

3

Your problem is not the ray cast, but that your grid cell doesn't reflect its actual state or in other words it might contain objects that it doesn't know about. When a certain object intersects a grid cell, the grid cell should know about it, this way when an object intersect multiple grid cells each grid cell should have a reference to that object, this ...


2

The most effective way to improve collision check speed is to decrease the number of entities that needs to be checked against. Spatial partitioning such as octree helps but you can make further improvements. Suppose if currently you have one big list of collidables contains objects and bullets and in each collision check step you are looping through all ...


2

Add a BulletCheck[BulletNo] == true condition. if ((BulletX[BulletNo] >= 103 && BulletX[BulletNo] <= 103.09) && (BulletY[BulletNo] <= -38 && BulletY[BulletNo] >= -45 && BulletActive[BulletNo]) == true) { BulletActive[BulletNo] = false; TurretTrial = TurretTrial - 5.0; if (TurretTrial ...


2

Touch screen record discrete points with a non-constant rate depending on how busy the CPU is and how reliable the hardware readings are. You need to "connect" those points as lines (old point from last game loop to new point) when checking for collisions and calculate line-line or line-circle intersection (or other type of line-object intersection). You ...


1

You might be able to use a combination of the two approaches. You could turn off the collider of the thrown object when it's lifted, and use a simple, invisible, collider placed on the body like so: You could then fire this collider directly out from the body. It should be on the same plane as the player and the enemies, so it seems like handling hits ...


1

In general you can check if any Intersection exist between your two lines as below. Problem: Given n line segments; Report all(as k in algorithms) Intersections. You can implement any of these two algorithm in your desire language and use them. they take your line segments as input and return if any intersection ( Collision in your case) exists. Note: ...


1

Well on your question fixture def, you set sensor true which makes it ignore collisions. fixtureDef.isSensor = true; Unrelated but as a side note, I think you need to dispose your polygonShape at the end after creating everything. polygonShape.dispose()


1

You need to put your thinking level one step backward, and try to imagine that there is a different way than the quadratic solve. You can use iterative solving. This will not give you a perfect solution in all cases, but when many entities moves relative to each other with 2 or 3 contact points in average, this is the fastest and gives very good results. All ...


1

Your canCollideWith method should be so that s1.canCollideWith(s2) == s2.canCollideWith(s1)I think. If not it means that collision will differ according to your array order. And if both return the same results you can test that only once. Then in your code, you give two differents definitions of your canCollideWith method canCollideWith(Sprite) and ...


1

It looks like you are using a matrix to rotate the image when it is drawn. This does not change the position values you have stored in your class, but it does affect how the image is drawn. If you want to know where the 4 corners of the image are drawn you will have to keep track of them yourself. Same is true of the bounding box. If the bounding box is to ...


1

As per @Krom Stern's suggestion, this is my solution to this problem. An incomplete, but working box cast algorithm for uniform grid: http://jsfiddle.net/d5ab67fj/1/. It currently is missing the end point cases and it only increment in X direction, but the algorithm itself is working. It will not miss any cells that the box would hit and it will not ...


1

Is this actually a problem? How much overhead would you incur by allowing the same check to happen twice in these cases? It is quite possible that the check would cause a bigger overhead than it saves. If you need to eliminate double results from the final set of collisions, I suggest that you do so after you have found them. The set of actual collisions ...


1

Are you always doing triangle v triangle, or could it be triangle v sphere? Regardless, I think I would break it down into two problems: collecting candidate triangles for collision detection, and the detection itself. As you point out, when you hash into multiple buckets you need to identify and reject duplicates. I have two solutions, both of which I have ...


1

Are you on track, yes no maybe. Figuring collision sets (moving vs. stationary) is helpful, but will not bring you far. If you implement a general NxM solution that is efficient you may actually get more bang for your buck. For starters you should separate your collision detection from your collision response. This makes sense since you may want to collide ...


1

Overview Essentially I think your talking about the problem where objects move to far in a single update step thus allowing them to seemingly pass through walls. This is a common problem, but an understandably irritating one for the player - although sometimes it's fun. Direct Solution The most direct way of answering your question I can think of is to ...


1

I recently went through this exercise and evaluated both on a couple of platforms. I found that my engine had many moving objects clustering on top of each other. As they moved around the Sweep and Prune (SAP) implementation caused too much sorting and overlap callbacks every frame. It was crippling my platform, which is not too powerful. I did all the ...


1

I think you and the commenters are on the right track. Ideally the hitboxes wouldn't have to be recreated on each attack (unless the nature of the attack were to change, maybe?). You could add something like this to every GameObject that can attack, along with a hitbox Collider marked as a Trigger. public class HitController : MonoBehavior { private Queue ...


1

I think I can help you someway. In Cocos2dx we could handle collision event with EventListenerPhysicsContact. check out this code: auto character = Sprite::create("chacracter.png"); auto body = PhysicsBody::createCircle(sprite->getContentSize().width / 2); body->setContactTestBitmask(-1); body->getFirstShape()->setMass(200); ...


1

Which version of PyGame were you using? An issue seems to have been fixed at some point between 1.9.1 and 1.9.2a concerning collide_circle() (see here for fix diff). It might be worth it to try 1.9.2a if possible (download/source here), which I believe isn't actually up on pygame.org. If you're on Linux or OS X you'll have to build 1.9.2a from source.


1

Change your red square collision box to a circle collision (or a sphere in 3D, the same issue can happen in 3D).


1

V-HACD V2.0 provides better decomposition results than HACD. Check it out! http://kmamou.blogspot.ca/2014/11/v-hacd-v20-is-here.html



Only top voted, non community-wiki answers of a minimum length are eligible