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
13 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 ...
2
votes
1answer
602 views

Collision in PyGame for spinning rectangular object.touching circles

I'm creating a variation of Pong. One of the differences is that I use a rectangular structure as the object which is being bounced around, and I use circles as paddles. So far, all the collision ...
6
votes
2answers
1k views

Collision detection between draggable object and world objects?

I have a game I'm making in Javascript that will involve combining items by dragging and dropping them onto each other. Think Alchemy or similar. So far, so good, but I hit a snag while trying to ...
0
votes
3answers
410 views

Moving a Polygon based on Camera position

I am in the process of implementing TMX Maps (made in Tiled) for my game. In Tiled, I can create polygons, which leaves a tag, containing the points. Loading in these points to a Polygon (java.awt....
0
votes
3answers
304 views

When the player collides with an entity, the player can no longer move

Here is my collision code, any ideas on how I can improve it to fix the problem? ...
1
vote
1answer
1k views

Finding the closest point on a concave mesh (Unity C#)

One of my game systems requires that I find the closest point on a generalized mesh, which more often than not will be concave. This prevents me from just using Unity's built in ClosestPoint function, ...
0
votes
1answer
61 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 ...
63
votes
11answers
96k views

What is the fastest way to work out 2D bounding box intersection?

Assume that each Box object has the properties x, y, width, height and have their origin at their center, and that neither the objects nor the bounding boxes rotate.
8
votes
1answer
939 views

Using PhysX, how can I predict where I will need to generate procedural terrain collision shapes?

In this situation, I have terrain height values I generate procedurally. For rendering, I use the camera's position to generate an appropriate sized height map. For collision, however, I need to have ...
0
votes
0answers
12 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
1answer
21 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
2answers
41 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 ...
1
vote
1answer
77 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 ...
8
votes
3answers
6k views

2D AABB vs AABB Sweep : How to calculate hit normal?

I've implemented a 2D AABBvsAABB sweep cast into my game, however, I'm having difficulty calculating the hit normal of the sweep cast. I have the sweep direction, both a and b AABB positions and xy ...
1
vote
1answer
93 views

Why is my AABB vs AABB code returning false positives

I am trying to do AABB vs AABB collision and the code is never finding a collision. ...
3
votes
1answer
37 views

Creating a victory zone / Count units inside zone

So I am attempting to create a zone implementation where if the amount of units with a certain tag exceeds the number of units with another tag an objective will be captured standing in the zone will ...
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 ...
6
votes
2answers
1k views

Multiple collisions within a single frame cycle?

So say you want to simulate several objects in two dimensions, just bouncing around in a finite space. Using AABB and sweep tests, it shouldn't be that complicated to calculate single collisions ...
0
votes
2answers
85 views

Collision stickyness problem on multiple inputs

I've been trying for a couple of days to solve an issue I'm having with top-down 2D collisions, whenever I collide with tiles that have adjacent collidable tiles my player sticks to the wall, If I ...
0
votes
2answers
90 views

AABB Collision Detection Confusion

I am trying to understand and implement AABB collision to learn simple 2D game physics. I'm following a tutorial and its method is a bit different to other websites. It uses the center of the object ...
1
vote
2answers
349 views

Java - Collision detection (Glitch)

I am working on a platformer game for the final year project in HS. However... The collision detection system I use is basically about checking wether a specific part of the character intersects with ...
3
votes
1answer
341 views

How do I make mask work

I have been trying to make a game, but mask collision doesn't seem to work. Here is my code: ...
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 ...
-1
votes
2answers
189 views

Inconsistent AABB collision detection

I'm making an endless jumper as my first game and I'm running into some problems with the one-way collision detection. Collisions are detected correctly most of the time but occasionally the player ...
1
vote
3answers
1k views

Changing tag on collision

I'm trying to switch the tag on my Player to something else when a collision between two unrelated objects happens, and then switch the tag of another object to Player, so my camera script will follow ...
2
votes
1answer
291 views

Collision detection

So I've made my collision boxes visual (Draw method) and I saw that there were some problems with the boxes and I fixed them (x, y, length, width). They are now big ...
0
votes
1answer
42 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 ...
0
votes
0answers
35 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 ...
5
votes
2answers
1k views

LibGDX - Tilemap Wall Collision Detection Issues

I cribbed some code from another web tutorial (SuperKoalio - https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/superkoalio/SuperKoalio.java) about detecting a ...
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 ...
0
votes
0answers
18 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: <...
1
vote
1answer
36 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 ...
13
votes
3answers
5k views

What is the best way to handle simultaneous collisions in a physics engine?

I'm writing a 2d physics engine in javascript so that I can learn more about physics in video games. I have it working correctly for rigid body collisions, except for if any body collides with two or ...
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 ...
4
votes
4answers
3k views

Interpolate and collisions

Lets take the simple example of a ball bouncing off a wall. The physics is separated from the display. The physics is set to run at say 20 frames per second and the display is running faster than this ...
0
votes
0answers
28 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
12 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 ...
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 ...
1
vote
1answer
52 views

Detecting a Collision Between Two Bodies Undergoing Multiple Transformations

I have been searching for an answer to this for a really long time and I have not found any definitive answers as of yet. What I am trying to do is determine if and when two bodies collided between ...
0
votes
1answer
122 views

Sebastian Lague 2D Platformer Controller 'Continue' Problem

In episode 10 of Sebastian Lague's "[Unity] Creating a 2D Platformer" series, he creates a jump through platform by using "Continue;" in his vertical collisions script. This worked great for a jump ...
0
votes
3answers
108 views

Stop checking for the same collision

I am creating a JavaScript game that is currently implemented as follows: Run a game loop Check for arrow keys pressed When arrow is pressed, calculate the new player coordinates if new player ...
1
vote
1answer
51 views

Collision Detection For A Maze/Cave

I have a simple code written in Processing 3.x that I am using to test out the collision detection for a cave/maze. The code is here: https://github.com/NoahJon3s/New-Journey-The-Game/blob/master/...
0
votes
2answers
140 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 ...
0
votes
1answer
87 views

Capsule to Sphere Collision

For my Maths unit at university, we have to manually calculate if a sphere is colliding with a capsule collider. The information I have to go with is this; You have the following Sphere: LadyBird3 -...
4
votes
1answer
2k views

What type of Collider should I add to a LineRenderer?

I am currently building a game where I need to generate some wires (as Bézier curves) using LineRenderer. After changing the width of each line ...
7
votes
4answers
4k views

Can I use two Collision Boxes on the same GameObject?

I have two Collision Boxes on the same GameObject. I don't want the Collision Boxes to be triggers. I want the Collision Boxes on the actual GameObject, not its children. For example, if I want to ...
0
votes
1answer
87 views

Unity 3D move kinematic rigidbody

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

Should your world map have it's own collision object?

I am attempting to understand collision detection at the moment. I have seen many examples of a simple flat plane with boxes or cubes which move around on the plane and react when the touch each other ...
1
vote
2answers
6k views

Pygame Collide Rect

Currently making a maze game. Maze is drawn, everything is drawn with pygame.draw.rect. I have tried using pygame.coliderect() to check for colisions, but it isn't working. The current error message ...