Tag Info

Hot answers tagged

25

But, how does one do collision detection on shapes made of small triangles? By not doing it. Collision detection against an arbitrary triangle collection (or worse, between two collections of arbitrary triangles) is prohibitively expensive. Instead, we typically perform collection detection in a hierarchical fashion, beginning first with extremely ...


3

Well, it's not new and it's a proper method. I think a common term for this "color picking", at least that's what i call it. As long as you are fine with picking only one object at a time, and that object being the one on top, there are no critical shortcomings. Even multi-select clicks are possible to a certain extend by mixing/adding colors/ids. ...


2

The collision detection is based on geometry (primitives like line, planes, spheres, boxes, capsules, cylinders). If you need to perform collision detection on shapes made out of triangle, for instance a terrain that is not flat, you have to test against all the triangles that form the mesh. If you get to that point, I would strongly advise to use a ...


2

Collision detection like this can be tricky. However - I do see a way around your problems. First, you definitely want to round off your "collision" position. In most cases, decimal numbers will cause collision problems when you're working with pixels (which are measured in whole numbers, usually). Here are two methods I thought up, in image form: (sorry ...


1

If you have multiple sprites at the same position, are they all supposed to prevent the player from falling? if so, you can either merge them, or disable collision for one. Else, if not all the sprites should collide, maybe you can add a flag to indicate if they are ground colliders. On a side note, you could use a complete AABB instead of using arbitrary ...


1

If you have stacked BoxCollider2Ds like that, Unity will only capture the mouse click on the topmost one. You could: Adjust the z-layer of your colliders (I think you do this by setting the renderer's "Order in Layer"). Enable/Disable your colliders in code based on which one is on top. Do a RaycastAll, and process the click yourself.


1

I think you are going at the problem the wrong way. Why are you first building an island and then "place" it? I would use one algorithm to create the entire map in one go. Although the algorithm would need some tweaking, but I would some form of noise as the basis. From that I use a "water level" to defined how much and how large the land actually is. This ...


1

Making collision detection frame rate independent is basically impossible. While you can reasonably implement frame rate independent rigid body motion and many other simulations by multiplying by dt (delta time), actual collision detection is "impossible" to do frame rate independent. To illustrate the issue let us assume you have a small cube moving at a ...


1

I have looked for this before and there is no easy, built in, way to do this. What I have done is in my objects that have a need for these checks to add a list and then on enter add to the list and on exit remove from the list. Also, if you can be more specific as to why you want to check for a collision I may be able to provide a better answer... But it ...


1

The easiest way to side-step this is: x = (int)x; y = (int)y; or x = round(x); y = round(y); Are either of these acceptable, visually? Edit: Diagram of modified SuperDoggy "Method 1" using floats: Precise overlap amount given by colliders Since you have so many cases, it may be helpful to make a helper for jiggling the rect: class CollisionHelper ...


1

Everything is green, so I can't tell what is is a player, what is a block, and what "2" means or is supposed to mean. I did make you this, however: The diagram can be mirrored and/or rotated and, with a tweak to the math, match any orientation of collider and collidee. Let me know if this isn't what you need and I'll try again. These triangles are all ...


1

You need to look into instancing a unit-cube. InputElements[] = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, ..., PER_VERTEX_DATA, 0 }, { "WORLDMATRIX", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, ..., PER_INSTANCE_DATA, 0 }, { "WORLDMATRIX", 1, DXGI_FORMAT_R32G32B32A32_FLOAT, ..., PER_INSTANCE_DATA, 0 }, { "WORLDMATRIX", 2, ...


1

The way I would go about it (did it in a few small games) would be to first move all objects, then detect and possibly correct collisions, and then draw. If you collide as you move the objects, you will end up with inconsistent states: if A has been moved and B has yet to be moved, you might detect and collision between A and B to does not actually exist ...


1

I thought this would be an interesting challenge to test some of the math I learned in school, so here's what I figured out. This approach assumes each object can be considered a circle for collision purposes. Naturally a car isn't a perfect circle, but it could be used as an approximation. You could use more circles to fill the area of the car better if ...


1

The way I solved this a long time back (I forgot about this question entirely until now), was that I just basically checked if the boxes intersected, because the rotation was just for a first person camera. So it only would have effected the viewport and movement code, the actual collision was just checking for an intersection. Basically, it was just me over ...


1

I want to update this considering the new shader stages recently added. Someone more familiar can probably be more thorough, but: such as a car's front end destroyed when it hits a wall? The new stages allow you to more-cheaply enhance low-poly models. You could generate an entire vehicle from a single cube's-worth of vertices (8). Given a relatively ...



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