Questions tagged [collision-detection]
Collision detection is the determination of whether or not two or more entities make contact with each other during gameplay.
2,498 questions
0
votes
0
answers
44
views
How to detect which physics body of skeletal mesh has overlapped?
I have a skeletal mesh with a Physics Asset assigned to it as such:
This skeletal mesh is used within an ACharacter with collision settings as such:
And an actor which has the overlap event as such:
...
0
votes
1
answer
168
views
Spawn enemy in empty space
I'm new to Godot and following a tutorial, which spawns enemies randomly. However, I'm trying to improve on this by checking that the enemies don't spawn on top of the player and cause an instant loss....
1
vote
0
answers
57
views
Colliders not in the same collision layers stopping each other from moving
I'm creating a space sandbox game (godot 4.5), and the core of my building system is attaching parts together to create assemblies. Each assembly is one rigidbody3D that contains all the parts. Since ...
0
votes
0
answers
88
views
Why does a colliding object immediately disappear?
I'm trying to make an enemy collide with collision tiles in GML. I don't think there should be anything wrong with it; it compiles, but every time the enemy either immediately disappears, or just ...
1
vote
1
answer
254
views
How to speed up collision detection if there are hundreds of objects?
Let's say I have like 500 Asteroids and I'm using SAT to determine whether a collision with the Spaceship object has happened. This would require an insane amount of CPU cycles, so it makes sense to ...
7
votes
1
answer
1k
views
Why are collision manifold points created inside objects instead of on their surfaces?
Suppose you have two overlapping spheres \$A\$ and \$B\$, with centers \$c_{A}\$ and \$c_{B}\$ and radii \$r_{A}\$ and \$r_{B}\$. Let
\$n = \operatorname{normalize}(c_{B} - c_{A})\$ be the collision ...
0
votes
1
answer
109
views
OnTriggerEnter called without a Rigidbody
I use Unity and the player controller in the game is acting strangely. It has a Character Controller but no Rigidbody. I use CharacterController.Move to make him ...
1
vote
2
answers
463
views
How do I implement the "collide and slide" algorithm in Unity?
I've recently been attempting (and failing) to create my own character controller for my 3D Unity game for around a week. I hate the Unity rigidbody physics system for making a character controller, ...
1
vote
0
answers
130
views
Original pacman hitboxes and cornering
I have been working on (somewhat) faithfully reimplementing pacman as a sideproject and means of better learning the rust framework Bevy.
However, there is one part that I really cannot quite get my ...
1
vote
1
answer
63
views
CapsuleCollider2D hitbox fails to trigger when player/enemy are stationary
I'm currently working on my first game in Unity, and I'm having some trouble with attacking. Currently, I have a game object with a 2D capsule collider child. When the attack button is pressed, the ...
1
vote
0
answers
116
views
How can I address multiple collisions within a single frame?
So, in my breakout clone, I've encountered issues where the ball will sometimes phase through bricks and the borders if it collides with one and then immediately collides with another after. My guess ...
1
vote
1
answer
208
views
Collision detection and physics in a 2d pixel platformer
I'm reworking physics in a 2d action platformer I'm developing (no engine, c++ / sdl). Here's the general movement logic for all characters:
I calculate the offset I need to apply to the character
I ...
1
vote
2
answers
222
views
How do you resolve collisions between two oriented bounding boxes?
I'm working on a 3D physics engine, and I'm trying to implement OBB/OBB collision detection. I was able to find Bullet's implementation here, that I'm trying to adapt. However, I still want to know ...
0
votes
0
answers
99
views
BSP partitions too small for effective collision detection
I wrote a BSP tree generation that takes a level mesh (basically a few thousand triangles), and creates a BSP tree. The generation seems to work, but when I traverse the tree, some splitting planes ...
1
vote
0
answers
87
views
How to handle collision events in games with multiple interactive objects?
I'm developing a 2D game where multiple types of objects interact with each other through collisions. Currently, I'm using pygame.spritecollide() to detect ...
0
votes
2
answers
201
views
How can I detect collision between a box and a minimum poly collision mesh?
Mostly a C++ newbie, trying to do a 3D game in Raylib.
I have a set of fairly irregular meshes that I'd like to see if a box collider has penetrated. For this project, a fairly high level of accuracy ...
0
votes
1
answer
123
views
How do I get a 3D collision with a Heightmap in Raylib?
I'm presently trying to do a sorta Starfox clone with Raylib, using the heightmap example here: https://www.raylib.com/examples/models/loader.html?name=models_heightmap
In order to handle collision in ...
0
votes
0
answers
26
views
Friction not applied in fast collisions using Continuous collision detection modes
Starting in Unity 2022.3 versions, this started happening -
In my scenario, I have a ball bouncing on a surface (e.g on concrete) and no matter what the friction values are, the ball basically ignores ...
0
votes
1
answer
85
views
How to destroy/remove Texture after collision in java box2d
I'm coding a simple Arkanoid/Breakout game and have problems with removing the bricks. I'm able to destroy the body but the texture is still there. I'm a beginner so is there a simple way to remove it ...
0
votes
0
answers
75
views
My Collision isn't working the way I want it to
I am trying to make a game slimier to Minecraft, where there is a world of blocks, and a player that can walk, jump, and place blocks. Lately, I've been struggling to get collision detection between ...
0
votes
0
answers
63
views
How to Make Circular Space After Collision?
How to make circular space after collision like this?
Before collision:
After collision:
I'am using PyGame
0
votes
1
answer
83
views
How to detect collisions between objects in a centralized game script?
Consider a game script that has an array of prefabs:
[SerializeField] List<Cat> cats;
Another script in the scene has created wall objects, which are ...
1
vote
1
answer
117
views
How to compute a normal in circle vs rectangle collision to push them apart?
I have a 2D circle, defined from:
c = circle(position = (x,y), radius = r)
I also have a 2D rectangle defined from
...
0
votes
0
answers
97
views
"Mesh is empty!" error when generating collision shape from mesh
I have a very basic mesh imported for this example. I just resized the default blender cube to a more plane-like structure and exported it into glb and then imported it in Godot.
In Godot, I created a ...
0
votes
1
answer
178
views
How can I improve vector collision algorithm?
I'm making a game (shocker) in pygame and had issues with tile-based collision detection. There are 5 different non-empty tile types (pictured below) which can be rotated in increments of 90 degrees ...
1
vote
1
answer
89
views
2D Square Collision Correction issue detecting which direction
I've just started getting into 2D game development and have been experimenting with some 2D collision and correction logic in canvas. I'm trying to debug this block of code and understand why it is ...
1
vote
1
answer
162
views
Unable to Shoot Enemies Due to Proximity in a 2D Game
I’m developing a 2D top down shooter where the player has a pistol. However, I've noticed that when enemies get too close, the player can't shoot them because the pistol doesn't have a collider.
I ...
0
votes
0
answers
91
views
Need help to organize 2D AABB collision engine quad node structure
In short:
I'm writing my custom 2d collision engine in C and I've chosen to use quad nodes to optimize collision detection. My implementation defines 2 things: the quad node (Quad_s) and the elements (...
0
votes
0
answers
87
views
Collision detection with CapsuleCast
I'm attempting to detect when a gameObject with a Capsule Collider and RigidBody attached it lands on the floor, which is a Mesh with a Mesh Collider attached it to it. Adding a tag to the Floor ...
1
vote
2
answers
284
views
Best Collision detection for slopes
I know this question sounds familiar but I'm working on a pretty big platformer (Written in PJS, on Khan Academy) and I don't want it to be just plain ground, I want slopes in the game (gentle slopes, ...
0
votes
0
answers
60
views
In Unity, how can I check whether two objects are sliding on each other or rolling against one another?
I'm coding a script to make objects emit appropriate noises on contact with other objects, with different sounds for isolated impacts, sliding, and rolling.
Impacts work just fine, but for the other ...
0
votes
1
answer
85
views
In Unity, how can a regular RigidBody know if it collided with a CharacterController?
I have a Unity CharacterController, that can detect collisions using the following code:
...
0
votes
0
answers
189
views
3D AABB vs AABB discrete collision - How to choose resolution axis?
I'm working on a simple 3D collision system that only needs to handle dynamic AABB vs static AABB. It needs a sliding collision response, but it doesn't need to sweep (i.e. doesn't need continuous, ...
1
vote
0
answers
217
views
Sweep and Prune algorithm performance
I just managed to implement my Sweep and Prune algorithm together with AABB and it's working correctly in the first axis (I haven't implemented second and third yet to complete the collision detection)...
0
votes
1
answer
175
views
BSP Tree Troubles and Unpredictable Results
I've been trying to fix this problem myself for ages, but I really do need help. I'm creating a BSP tree for my 3D game (baked in the map files, quake style) to replace my existing naïve collision &...
0
votes
0
answers
102
views
How to resolve collision between wedge and AABB or capsule
I have a 3D world where all of my terrain uses AABBs as collision volumes (think minecraft, but not strictly cubes):
I want to add wedge pieces as a terrain option. They'll have various slopes and be ...
0
votes
1
answer
139
views
Why is my player not colliding with animated obstacles?
I can't figure this out. My obstacles have a basic box collider on them and my player has a rigidbody based controller and collsion detection is set to Continous and when obstacle hits him it just ...
0
votes
1
answer
200
views
How to get around mouse entry signal stopping at first collision?
I have a grid of Area3D objects, and when nothing is around them, they handle the mouse_entered signal exactly as I would expect. The only issue is that I also use Area3D's on other game objects, like ...
0
votes
1
answer
84
views
Chain cutting swipe input skips over chains
I have a game where you need to cut chains, similar to Cut The Rope. I want to develop it for Android, so I need mobile controls.
For detecting swipes I used ...
0
votes
1
answer
149
views
Object collision and vector reflection for complex polygons?
I am currently creating an environment to train aim-bot AI's for my game. It is a 2d world made of complex polygons, and the goal is to have the AI's shoot ricocheting bullets. Using a ray-casting ...
0
votes
0
answers
108
views
AABB Collision Resolution Per Face
I have this function that detect the collision of two AABBs:
...
1
vote
2
answers
169
views
Representing a concave polygon as a hull "minus" convex cavities
I am implementing 2D collision detection, and trying to tackle the problem of concave polygon vs. shape.
The SAT works only for convex shapes.
I was wondering if the following approach is a viable ...
2
votes
1
answer
163
views
How to set up high-performance collisions for level geometry in Unity?
I'm new to Unity. I was wondering what the best workflows were for placing colliders.
I'm going for high performance, and I've heard that mesh colliders aren't as performant as just placing down box ...
1
vote
1
answer
88
views
Player not sliding on the side of a wall when two keys are pressed
I am making a game right now, and I am working on collision for different Rect walls (all of their data is stored in a list). It works great, except for one problem:...
0
votes
0
answers
146
views
delta_time with the new move_and_collide() function in GameMaker
Is this implementation of delta time in recent Game Maker reliable?
var dt = delta_time / 1000000
move_and_collide(spd_h * dt, spd_v * dt,obj_world.solid_tiles);
...
0
votes
3
answers
146
views
Reduce processing time of image to shape
I'm making a simple game engine using Java and have found a major issue.
To create accurate collision detection I decided to convert a transparent image into a ...
0
votes
0
answers
458
views
Collision between a sprite and a rect in PyGame
I'm trying to make a simple platformer game, which has code to move the camera towards a player as they jump around.
Now I have two classes: one for the player, and one for the platform.
In the ...
0
votes
2
answers
176
views
How to check if an AABB is colliding or the mesh itself
I have the following problem. I would like to check in bullet whether only the AABB collides or the mesh collider itself. Unfortunately I can't find out how to do this
Within the screenshot you can ...
1
vote
1
answer
137
views
Issue with AttackArea Monitoring Before Attack in Godot 2D Game
I'm developing a 2D game where the player character can attack enemies using a designated attack area (Area2D node named AttackArea). I've encountered a problem where the AttackArea is active and ...
0
votes
2
answers
115
views
How to implement rigidBody movement and collision in local axis X while moving the body automatically in local Z axis?
I'm making a very peculiar outrun clone. I need the player to move forward automatically while being able to change his position on the road in his local X axis.
I made infinitely generated road and ...