Questions tagged [collision-detection]

Collision detection is the determination of whether or not two or more entities make contact with each other during gameplay.

Filter by
Sorted by
Tagged with
1
vote
1answer
136 views

OnCollisionEnter2D just flat out not running for certain objects

I am working with the Unity3D Engine in 2D mode. Currently I am trying to make a circle collider bounce off of a composite collider for the walls of my game. The only issue is that for some reason the ...
0
votes
0answers
45 views

How to deal with pushing objects out of collision

I am developing RTS game in unity3d. I have thousands of units running around the battlefield I can't use unity physics component for collision detection as physics API is not available for job system ...
1
vote
0answers
57 views

Avoid object from bouncing non-stop after AddForce() is applied to it

I want to implement some sort of elastic field on my light blue magnetic field when a cylinder is colliding it, it worked except the lines won't stop bouncing. I am enabling the trigger collider on ...
0
votes
1answer
167 views

Terrain collision with sphere and OBB

I'm implementing my physics engine for my 3D game. So far I've been able to implement collision detection between OBB, spheres and planes. The engine generate contacts and resolve them with an ...
0
votes
1answer
142 views

Drag Object to Collide Unity

Please help, I am developing a 2D game for a school project and I want to drag the apple to the think box then when it collides, the apple will go back to the original position then it will add 1 ...
1
vote
1answer
77 views

Bump and push entities without a physics engine

I have seen on many games the ability to push entities around and bump into enemies/characters. What is this called? I have implemented Matterjs to accomplish this with Pixijs but it seems overkill ...
1
vote
1answer
56 views

detect collision between two circles and sliding them on each other

I'm trying to detect collision between two circles like this: ...
2
votes
1answer
384 views

AABB to AABB collision response

I am currently trying to resolve collision between two AABBs. I already have a function that can detect if the the two boxes are colliding and returns true if the two boxes are colliding. The problem ...
4
votes
4answers
3k views

What would be the best approach to creating a pressure plate in a 2D game?

I've just really gotten started in Unity and while documentation has been helpful I haven't figure out how to detect collisions with 2 or more objects. I was able to get a script working that plays a ...
0
votes
1answer
17 views

Unity2D Register which player colliders have activated

I have a player character that has three separate coliders that form this shape (one for the top, one for the bottom, and one for both sides) I'm trying to register floor collisions with the bottom ...
0
votes
2answers
139 views

Tetris Glitchy Movement Fix

Usual tetris game has 2D arrays for arena/piece and collision check with matrix comparison. To add smooth movement and auto alignment of pieces: x and y are pixels on the screen xMatrix [the cell ...
0
votes
1answer
235 views

How to manage collision between balls in Game Maker 2 (Drag and Drop)

Hey there I'm using Game Maker 2 Drag and Drop for a project, I made a game like Break Out and when the ball collides with the wall it doesn't bounce, in Game Maker Studio we had Bounce Action but in ...
1
vote
1answer
126 views

How to allow to slide rectangle to not colliding with corners between two rectagles?

I am detecting each side of collision between two rectangles, and wen I collide them, lets say, with the left side, it also detects collision on the top side when I move to the top, and the downside ...
0
votes
2answers
128 views

How to use separating axis theorem to allow for sliding along walls

I'm making a 2D platformer game and using the separating axis theorem for collision detection, but I want the player to be able to walk along the ground and slide on walls and other stuff and I can't ...
1
vote
0answers
20 views

How to determine angle of incidence, resulting position, and resulting velocity for a point with position and velocity appearing within a rectangle?

I have a rectangle positioned on a 2D Cartesian coordinate system, and its minimum x and minimum y are represented as a coordinate pair (xrect, ...
1
vote
2answers
481 views

Collision detection in 2D games

I am making a basic 2D platformer. I want to get the relative position of one rectangle to another. This is how I do it right now: ...
0
votes
1answer
71 views

Most efficient way to check collision

For example, I have a player and a map, to check player collision with some block we need to check entire map tiles, but the bigger the map, the slower the framerate. What's most efficient way to ...
-1
votes
1answer
34 views

trying to work out coords based collision [closed]

In this game I'm working on, both player and enemies are represented by 32x32 sprites(not using bounding boxes). I'm trying to make a system where if the x and y coordinates of the player and ...
1
vote
3answers
144 views

Splice enemy array to destroy enemy (js game)

I am currently working on a basic space invaders game. So far I have created the enemies, a main character, and a laser beam, collision detection between enemy and bullet, however when my bullet ...
0
votes
1answer
505 views

Separating axis theorem OBB vs Sphere

I am trying to implement collision detection in 3D between OBB/AABB and sphere. For this i'm using sat/separating axis theorem. For sat to work in 3D i need face normals of obb (sphere to face), each ...
1
vote
0answers
31 views

Affect of timeStep on PhysicsBodies in SceneKit

In SceneKit, I had a problem on collision of two dynamic spheres, when the one strikes to another with fast speed, it was passing through inside of it. After i have reduced physicsWorld.timeStep value ...
0
votes
1answer
552 views

Why is my spherecast returning an incorrect hit on mesh collider? (Unity)

I have a mesh collider that is largely a flat plane facing up. Any SphereCast against that surface should return a normal of Vector3(0, 1, 0), but that isn't always happening. When near an edge on the ...
0
votes
1answer
178 views

How to know the point of collision with another object in Unity5

I have a small problem and it would be very helpful, which could guide me. What happens is the following, I have an enemy (evil usb) in my scene, to the collisionar this enemy with my main player ...
0
votes
1answer
121 views

Handling exact collisions on character controller and/or other objects in unity? (eg. head shot, chest , leg,etc)

Hello all I have been working on games in Unity for a long while (making slow progress as I do it purely on my own , and of course you helpful people here on gamedev.stackexchange!) I've made lots of ...
0
votes
1answer
107 views

AABB test does not consistently detect edge-to-edge contact when bounds are very different in size

My function compares two AABBs for collision detection, and when they are around the same size it works fine, but I noticed that if I greatly decreased the size of one of them (or augmented the size ...
1
vote
2answers
63 views

Collision and changing the scene. C#

I'm running into a problem where I want to create some code that such that if an object (Cube) is destroyed, it to changes to another scene. Here is my code: ...
0
votes
1answer
55 views

libgdx - Problem occurring after collision detected

I have just implemented collision detection in my little 2d rpg-like game. I'm using Tiled for the maps, mechanism is simple - I have one layer called 'collision' in my tiled map, and while loading ...
0
votes
1answer
52 views

How to implement level-player collisions resolution?

I want to create simple collision response system (physical simulation is not required now). It is needed just that player can't go through walls. I consider some variants: - Just create a set of ...
1
vote
1answer
810 views

How do Axis-Aligned Bounding Boxes update with rotations?

I have a bounding box class with a min (x,y,z) and max point (x,y,z). The object that is being rotated has a rotation matrix (3x3 matrix), but I don't know how to update the bounding box with ...
0
votes
1answer
257 views

How to Design a Generic Collision Detection System?

I'm designing a C++ 2D collision module, and I ran into a problem designing a system where the collider is unaware of the shape it's colliding against. I'd like to have a abstract base class called ...
0
votes
1answer
163 views

Physics.IgnoreCollision not working right after invoked

When invoking Physics.IgnoreCollision in Unity, it seems work but it still have collision detection right after creation. I have this issue with ejecting empty case after gun fire, it's spawning ...
2
votes
0answers
147 views

How do you find the collision between 3D boxes and 3D QUAD face meshes?

I have an axis aligned bounding boxes for 3D object collision, but I have a complex 3d mesh that's divided into 3d faces so I want to check for bounding boxes and collision with the faces of that ...
0
votes
1answer
86 views

How can i collide two bodies without filtering(collision filtering)?

I have two bodies with fixtures. One is platform or ground and other is the player itself.I want to collide the player to the platform without bit filtering.How can i do that?I can see the rectangular ...
0
votes
1answer
908 views

Unity: Water shader vertex offset - how to add mesh collider which updates with vertex offset?

I have written a shader (in the new LWRP shader graph) which simulates an ocean with vertices which offset to create a moving "waves" effect. I believe that in order to have objects "float" on my ...
0
votes
1answer
44 views

How do you create hitboxes that will detect stationary targets too?

I've created a basic attack combo system that chains 3 attacks together. When the player clicks the mouse button, it enables a boxCollider2D attached to the player. The boxCollider is a trigger and ...
0
votes
0answers
308 views

Detecting collisions without rigidbody

I have a car with the following aspect: As you can see, colliders are locally static, because they are separated from the original rigidbody component. Well, as you can suppose, I have a problem, ...
0
votes
1answer
116 views

Does destroying body also destroys the sprite?

Suppose a sprite is attached to a box2d body. And world.destroyBody(b); is getting called then the sprite also get destroyed or it stays there in memory. In my ...
0
votes
0answers
153 views

Object moving by adding force to Rigidbody bouncing off where ground objects met

I have a object that moving by adding force to rigidbody. With just big flat plane, it works fine but with connected small planes, sometimes(actually not sometimes, a lot) the object bouncing off or ...
2
votes
0answers
150 views

Getting false positives with SAT

I've been trying to get proper collision detection with SAT in 3D. I started of with this post: How many and which axes to use for 3D OBB collision with SAT. I've been trying to get the right axis to ...
1
vote
0answers
50 views

VRTK ignores IsTrigger

VRTK allow collision detection by adding the VRTK_HeadsetCollision, VRTK_BodyPhysics, VRTK_HeadsetFade and VRTK_HeadsetCollisionFade scripts into Unity. This works so that in VR when I walk through a ...
0
votes
0answers
117 views

Cache friendliness of AABB-Tree: binary vs N>2

I found that state-of-the-art physics engines like Bullet and Box2D all use binary AABB-Tree for broad-phase collision detection. I wonder, did anybody tested AABB-tree with >2 branches per node ? ...
0
votes
1answer
109 views

2D Per Pixel Collision Detection using Animated Sprite

I am using MonoGame 3.6 and Visual Studio 2017. I have been trying to find a solution online to do per pixel collision detection using an animated sprite that I am drawing from a sprite sheet. Using ...
0
votes
3answers
789 views

How to optimize collisions

I'm building a 2D MORPG using JavaScript, Node JS and socket.io To prevent cheating, I have to run all collisions for all players on my server. I'm currently doing fairly simple square collisions ...
0
votes
0answers
68 views

Collisions between two objects in 2D space

I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to ...
0
votes
2answers
67 views

Bug with OnColliderEnter/Exit when colliding with multiple objects at almost the same time

Unity Version: 2017.4.1f1 I currently have a game with a jumping mechanic. I only want the jump to work where you're on ground, so I have planes on top of everything, which, if you are on a plane, ...
0
votes
1answer
282 views

Can I test collision inside an edge collider area in Unity?

I draw a triangle with the edge collider2d and I want the player to make an event when he reaches this area, so I set the collider as a trigger and, I used the OnTriggerStay2d function in my code! ...
1
vote
1answer
889 views

Unity Tilemap one way collisions

How can we get one way collisions using Tilemaps in Unity? There doesn't seem to be much online regarding this topic yet. From this link: https://answers.unity.com/questions/1471156/how-to-make-one-...
0
votes
1answer
123 views

Collision not smooth in unity3d

I am working on a project(Racing car). When it hit an object the object should be destroyed. The Object is being destroyed when it is hit, but the car stops for a moment after hitting like an obstacle....
1
vote
0answers
175 views

How do I create a HeightField in pybullet?

I've been looking for documentation on PyBullet, the python implementation of Bullet, but I haven't yet found a way to implement the btHeightfieldTerrainShape collision object, which I need to make, ...
0
votes
1answer
495 views

Ray-box intersection problem

I try to implement ray-box intersection algorithm given by the following code. However, I'm not really understand for two cases as shown in the following figures. Firstly, when the box is located in ...