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
0
votes
0answers
5 views

Q: 2D cone and rectangle collision detection

I'm working on a 2D RPG game and now I need to detect if players ability collides with enemy rectangle hitbox. Currently I have this code that detects if a point is in cone, but I need to modify it to ...
0
votes
0answers
30 views

What's wrong with my line segment plane intersection code?

I'm following the algorithm on on this website for my line segment intersection test code. But when looking at my line segment and plane intersect it doesn't produce the correct point of intersection. ...
0
votes
0answers
19 views

Collisons with rock and player(spaceship)

I'm trying to make when the rock hits the spaceship or player it should decrease the health from the health bar but when I run it, it doesn't work. The rock decreases the health randomly. How can I ...
0
votes
0answers
29 views

Why isn't OnCollisionEnter being called?

I have a hammer and an object to be hit in my scene. I put this line Debug.Log("Collided with" + collision.gameObject.name); to debug whether the function ...
0
votes
0answers
11 views

Change Box2D body color in Python

I have this very simple code which contains a square and a ground, the square is falling down and when it reaches the ground the gravity will change its direction and the body starts to move upwards (...
0
votes
1answer
45 views

Collision with walls in a completely tile based game

I am making a tile based game, in which also the player movement is completely snapped to the grid. Imagine sokoban. I basically have a 2d array for the layout of the level (walls / not walls), and ...
0
votes
0answers
41 views

2D Spatial Hashing in C++ Causing Game to run more Slowly

I'm trying to use spatial hashing to speed up collision detection in my game. I believe spatial hashing is better suited for my game than quadtrees, because I have lots of fast-moving objects in my ...
0
votes
0answers
9 views

How to Tag sprites in tilemap unity

I am trying to detect collision with particular sprites added in scene using tilemap, collider is added to all the tilemap,Is there any way I can detect collision with only particular sprite from the ...
0
votes
1answer
50 views

Collision detection / physics for simple game

I am currently working on a mini game for class (first time doing something like this) and I don't really know how to start with collision detection at all. The game I'm creating is a top down sumo ...
0
votes
1answer
67 views

How to get the overlap volume of OBB and or ABB?

The following code is a current attempt at a function I have to determine if two bounding boxes overlap. The bounding box structures are [min[x,y,z], max[x,y,z]] ...
0
votes
1answer
76 views

I am having trouble with gravity in my game

I am trying to detect if the player is on an object with a tag "canHoldWeight". But the detecting if the player is on an object isn't working. falling code called every tick: ...
0
votes
0answers
31 views

How to stop background audio upon collision [closed]

I have a basic 2D game and have added some music in the background that plays on a loop. When my player collides with an object another sound plays to indicate that the object has been hit. How ...
1
vote
1answer
39 views

2D Collision detection: rewinding to moment of first intersection

I am working on a collision system in a Platformer tile-based game. All tiles are AABB. I am trying to implement "Rewind to Moment of First Intersection" mentioned in this post's second point. The ...
0
votes
0answers
30 views

Adding Score to score canvas after collision [duplicate]

Simply a player has to move through pipes falling down, once the player moves through the gap it should add a score and increase the scoring after each pipe the player goes through, pretty basic. I ...
0
votes
1answer
51 views

How can I keep track of which “rooms” characters and NPCs are in?

I have a Unity 2D project which has a player character and numerous NPCs all potentially moving (top-down) at the same time during play. The number of NPCs is not to exceed 100 (and will be, probably, ...
0
votes
1answer
92 views

Why am I able to go through the walls, and how do I fix it?

I'm working on a tile-based platform game and now I'm stuck with the collision detection and collision resolving. The top and bottom collision and resolving works fine; when it happens, I set the ...
1
vote
0answers
30 views

What would be the best way to let Box2D handle collision on different (simulated) heights?

I'm working on a 2D top-down game but we are also using a Z coordinate. This is to simulate the effect of 3D/height. Now the player can walk under a bridge and also over a bridge. The next thing I did ...
1
vote
1answer
107 views

Tilemap collision in Pure ECS?

I'm currently making a 2D topdown dungeon crawler using pure ECS and Data Oriented Design. So I only use structs of arrays for all my components. I have now added tilemap generation, but was wondering ...
0
votes
0answers
42 views

How can I implement ground clamping across slopes in my 2D collision controller?

I'm working on improving my 2D collision controller, but am having trouble with "ground clamping" when my object moves past certain slopes on which it should be descending. The controller takes the ...
0
votes
2answers
26 views

Unity3D playing sound when Player collides with an object with a specific tag

I using Unity 2019.2.14f1 to create a simple 3D game. In that game, I want to play a sound anytime my Player collides with a gameObject with a specific tag. The MainCamera has an Audio Listener and ...
0
votes
0answers
25 views

Collision Filtering using Python and Box2D

I am trying to filter collisions occurring in my Box2D world by reproducing this example: https://github.com/pybox2d/pybox2d/blob/master/examples/collision_filtering.py I have four classes in my ...
0
votes
0answers
13 views

Elastic Collisions in Unity 2D

I am trying to create elastic collisions in 2d game in unity. I have a ball surrounded with a polygon collider and im calculating the reflected vector using the ball velocity and the normal at the ...
0
votes
2answers
50 views

Player disappears when it collides with a tagged object

I am working on a simple game where the goal is to help a Player catch specific objects with a tag "Present". After taking care of the models, animations I am now working on the collisions and ...
0
votes
0answers
18 views

Preserving original direction when collision changes direction

I have sliding for player characters and it's working, but running into a small issue. The original direction gets lost, and I'm unable to resume the original direction. My characters have a ...
0
votes
0answers
36 views

Catch blocks while dodging other elements game

I'm working on this game where the user gets points for catching the right falling colour block. If the user catches the wrong colour block they will loose the game. For ex: I assign the user to ...
0
votes
0answers
22 views

Obb vs triangle test is incorrect

I have programmed Obb vs Triangle test from https://www.geometrictools.com/Documentation/DynamicCollisionDetection.pdf. However, when I run the test, I got incorrect results. I have this test case: <...
41
votes
1answer
4k views

How to differentiate landing on top of an object from falling down the side?

I am looking for a conceptual solution to my problem. It's a simple platformer-alike game where player can move horizontally during free-fall. Consider those two cases: In the first case, from game ...
1
vote
1answer
86 views

Don't block Camera with Blocking Volume in Unreal Engine

I use Blocking Volumes to prevent players from falling off platforms in a third-person perspective game in UE4. These Blocking Volumes however block the camera, as if they were a physical wall. How ...
0
votes
0answers
18 views

How to detect collision while the animation is running to move an object to the next coordinate?

I implemented SAT collision detection in Python with the GUI library pygame. It is working well, except when the objects are going too fast. I have velocity and acceleration variables. For each loop ...
1
vote
1answer
18 views

body_entered signal won't emit when rigidbody collided to rigidbody

I have multiple rigidbody object floating away in the space. When they hit each other, they push away each. I want to destroy object if they hit something, but connect body_entered signal won't ...
0
votes
1answer
28 views

Pybox2d Collision detection explanation

Hi I am working on a PyBox2D game and it became quite complex and I need to learn about collisions, so I made this very simple script in order to learn collision setting more effectively, however I am ...
0
votes
0answers
33 views

RigidBody Collision Handling with Verlet Integration

Hi I'm reading the Jakobsen Paper "Advanced Character Physics" which explains how the verlet integration along with a tetrahedron (4 particles) can form a structure usable for rigidbody (with 6 length ...
1
vote
1answer
46 views

How to detect a collision and collision impact?

I would like to calculate "impact" of collision if its the right word for it. My scenario is: I have player, who is driving his vehicle. He then hits the wall while still in vehicle. I want to know if ...
0
votes
1answer
45 views

Unity get reference of GameObject under another GameObject

I am trying to get reference of the object underneath my Player. I don't know if I am aproaching this correctly. Right now, I have a player simply put in the scene, like this: Then I am trying to ...
1
vote
2answers
59 views

Resolving collisions after initial collision

Given a sweep test for a ray, how do we check collisions after the 1st collision has been detected, and the ray has been deflected. Physics system steps are: Update velocities (gravity, etc) Resolve ...
0
votes
1answer
211 views

Unity 3D move kinematic rigidbody

I'm trying to move a kinematic rigidbody (a spaceship) with this code: ...
1
vote
1answer
93 views

3D line segment AABB collision, with hit normal?

I'm embarrassed I can't find this, but I'm wanting to detect intersection with a 3D line segment (not an infinite ray) with a 3D AABB, the AABB being defined as two Vec3f's which represent the Min and ...
0
votes
1answer
44 views

Detect collision on explosion

I am creating spells for my game. The collision with a normal fireball works just fine, what I am trying to achieve is to have the player_2 getting hit when the ...
0
votes
0answers
25 views

Numerical errors in Player collision offset causing player to fall through the ground the next frame, how to avoid?

I'm trying to implement player physics with arbitrary objects, in this case, a bunch of cubes. I wanted to add a "floor" so in my cube collision function, I added the following following lines: <...
0
votes
2answers
146 views

How do I detect collisions between a point and a sloped line?

The character in my game constantly falls due to gravity, so i have to detect the collision between the bottom point of the character and the tile slope line on the same x coordinate. The character ...
-1
votes
1answer
30 views

How to make wheelcollider not stutter when moving on high speed?

I have a wheelcollider attached on a rigidbody and i move the object using : "transform.position += transform.forward * speed * input.getkey(keycode.uparrow)" And when the speed increasing the ...
0
votes
3answers
57 views

Both Trigger and Collision BoxCollider2D

My Player sprite needs to collide with some objects and be unable to pass through them and in other cases detect when it passes through some object (e.g. some non-...
0
votes
2answers
33 views

Get Closest point between a Box 3D and a Point

I have a point A (x, y, z), and a Box: Center (x, y, z), Size (Width, Height) How to get the closest point in the box from the point A ? In Unity I can create a bound, and I can find the non-rotated ...
0
votes
1answer
34 views

Space game scene boundaries

I've been trying to add boundaries to my space game. I've been following this tutorial with a sphere instead of a cube, but every time I start the game and move or rotate my ship it appears outside ...
3
votes
1answer
155 views

Quadtree for AABB collision boxes

I have a whole bunch of entities constantly being processed and testing for collisions. I've tried to optimize this by stopping certain entity types from checking each other, dead entities not being ...
0
votes
1answer
51 views

3D Collisions - Walking below a slope pushes me through the floor

Here's a really short video (less than 30s) of this issue : https://www.youtube.com/watch?v=JrKbpTY8cMU When I move the player towards a slope (the player is below it), it pushes the player inside ...
0
votes
1answer
55 views

Box2D Weird collision behavior

I'll let the gif speak first. As you can see, the small cube just kinda floats there like it has a forcefield. This weird glitch only happens with small cubes, smaller than 60 pixels for some reason. ...
0
votes
2answers
99 views

How to handle objects at the edges of spatial partition cells?

A lot of games store object positions as floats and have a closed ball for the game area (eg. a rectangle and objects are allowed to have position coordinates on all 4 edges). However, this becomes ...
0
votes
1answer
42 views

why child class can access object while parent can't

I have Block class which is the parent and StandardBlock the child , the prefab block have StandardBlock script attached to it, and according to my small knowledge in inheriting I though this would ...
1
vote
2answers
97 views

How To Resolve Collision Before it Occurs

I have 2 objects, A and B, in a 2 dimensional space. If I know A is trying to move by vector M (that is to add vector M to the positional vector of A), and that A will collide with B after A moves, ...