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,446
questions
0
votes
0
answers
16
views
Bounding Box/Rectangle collision glitches
I've been working on this golf game for a couple of weeks and have been trying to create a reliable collision system for whenever a golf ball (mini golf) hits a block. I'm using regular rectangular ...
0
votes
0
answers
50
views
Pixel platformer character collides with blocks above while there's still a visible gap
I was trying to the set up a tile map for a 2D pixel art game in Godot 4.1 (following a tutorial) and realized that there seems to be an issue or something I am not aware of with the way collisions ...
0
votes
0
answers
42
views
Managing multiple collisions in a single frame
I have a object with box collider that spins 360 degrees before destroying itself. I have a lot of enemies spawning around the player. The object spawns, spins and destroys itself. Imagine it like ...
1
vote
0
answers
32
views
Separating axis theorem implementation results in limitless extending colliders along the Z axis
I am trying to implement SAT and it works except for the fact that colliders extend infinitely along the Z axis and I can never get past them. I also have confirmed that ...
0
votes
0
answers
72
views
Seperating axis theorem is bugged
I am attempting to make split axis theorem for 2d collision physics. It does works, but is inaccurate. It is based off of: https://www.gamedev.net/tutorials/programming/math-and-physics/a-verlet-based-...
0
votes
1
answer
25
views
OnCollisionStay outputs strange contactpoints
I am currently trying to make a pen draw on a paint.
I am searching for contact points on the paint but there is too much contact points than expected.
I'm not sure to properly understand how ...
1
vote
0
answers
35
views
How to fix collision for objects beyond their green lines?
As you can see in the image those are collision lines but its kinda of disingenuous as there are I would say invisible collision blocks on the X's, I tried messing around with the sorting layers and ...
1
vote
1
answer
288
views
Area2D only detecting body_exited once
I am new to game development, I am practicing by creating a pong game.
I currently have an Area2D set up with a signal listening for ...
0
votes
1
answer
60
views
Test if a point is inside a 3D cuboid, given the 8 corner positions, through code
I'm trying to find to obtain if a point, let's call it "v" is inside a cuboid which every corner position named P1 to P8
I am trying to achieve this and in fact found some answers in some ...
0
votes
1
answer
46
views
How can I change scenes when the player touches another CollisionShape2D in Godot 3.5?
I need to know how I can change scenes in Godot 3.5 when the player touches another CollisionShape2D.
I've tried this:
...
0
votes
1
answer
36
views
How can I make colliders-only visible in Godot?
Specifically, I'm looking for any way to see a collision-only item from a Mesh Library in a GridMap. (The tag says "tile map", which it technically isn't; but there's no option for a grid ...
0
votes
0
answers
45
views
Brick Breaker - Adjust ball's collision angle without affecting speed
I'm working on a Java Brick Breaker game, and it's functional so far. However, I'm facing an issue with collisions. Currently, when the ball collides it simply reverses its direction.
I want to ...
0
votes
2
answers
90
views
How does unity refer a to a normal when there are so many?
When an object collides with another object, does unity calculate the normal, or return it from the list of normals?
0
votes
2
answers
57
views
How do I detect a hit by a swung held object?
I have an XR Grab Interactable wrench and the grab is working fine, as is movement. I'd like to use it to smash some chains, so I figured that I could use an OnCollisionEnter on the chains, and check ...
0
votes
2
answers
86
views
Detecting collisions with trajectories
What if an object were to have collision detection implemented as so: A ray in the direction the object is moving in, and a ray in the direction of gravity.
0
votes
1
answer
110
views
Why check the ball and brick collision twice?
I watched https://www.youtube.com/watch?v=F86edI_EF3s.
I believe the following code is the complete code
https://github.com/games50/breakout/tree/master/breakout13
And
https://github.com/games50/...
0
votes
0
answers
18
views
Does unity transform world to local considering rotation
I want to implement oriented collision in unity as a test, and for convenience I just wanted to know if local space is also based on rotation. I wanted to check at least two objects against each other ...
0
votes
0
answers
55
views
How is terrain collision handled
GJK can be used for all shapes but what if the points in a figure aren't indexed, then how can we get the Minkowski space by adding the correct pairs of points even though we don't know them, and also ...
0
votes
1
answer
51
views
Why are the transform game objects moving away from the snail when they are swapping their direction?
I am making a game in which I created a character (main player) and another character(snail). Now the snail will move on the ground, when there is no ground detected it will change its direction. I ...
0
votes
1
answer
17
views
Change of computing power/ time needed when imported Mesh triangle number changes
I am doing a Unity project, that makes it necessary to import a mesh consisting of triangles.
As it is possible to reduce the amount of triangles in a mesh and keeping the structure similar, I am ...
0
votes
1
answer
39
views
Time aware point -> capsule swept collision detection?
the simplicity of Minkowski sums are one of the big reasons capsules are used in collision detection, especially for player models. One of the benefits of this should be the ability to perform ...
0
votes
0
answers
28
views
Decrease size of hitboxes for a sprite in PixelPAD
I need to make the hitboxes of spikes smaller, so that it's not impossible for the player to get through. How do I do that?
2
votes
1
answer
164
views
Character controller that can handle sloped terrain and boxy ledge traversal
I am working on a character controller for a 3D platformer in Unity. I cannot find an approach that satisfies me.
I have experimented with these approaches in order to learn about their virtues and ...
0
votes
0
answers
23
views
Casting out vision rays for 2D car in pyglet to return distance from objects?
I am working on a machine learning project that involves training a 2D car to drive around a top-down racing track. I'll be training neural networks using different algorithms and one essential form ...
0
votes
0
answers
33
views
how to get all points contained in the area of an object of any shape
how would I get points contained by objects, so that I can check for intersections of points, and I also ask myself if checking for intersections each frame would be too CPU intensive?
0
votes
1
answer
87
views
The bottom of the player capsule collider is going into the ground box collider
The bottom part of the player capsule collider is going inside the ground collider. I am using a raycast for detecting whether the plauer is grounded; an object (sphere) that is present on the bottom ...
1
vote
1
answer
92
views
Detect intersections between an `AABB` and a `CollisionShape3D`
I thought this would be a simple matter of getting the mesh that defines the CollisionShape3D and checking if any of the triangles of the mesh intersect with the <...
1
vote
1
answer
52
views
Bullet not colliding with either plane or drone
i made a godot game in which theres a player and a drone, I got the shooting to work but when i tried to make it so that the bullet attacks the drone/player, it wasnt working properly. Basically i ...
1
vote
0
answers
81
views
How to get OnTriggerStay2D working?
I am trying to make a flamethrower weapon for my player character. I am using a system were I can change between weapons, and every other weapon works perfectly. The flamethrower is able to turn on ...
0
votes
1
answer
87
views
Trying to calculate hitbox vertices for my game and adding SAT collision
I am currently working on a basic HTML, CSS, and JavaScript game as a freshman high school summer project. I am currently trying to implement separating axis theorem (I spent a lot of time learning ...
1
vote
1
answer
35
views
Platformer Sprite is inside of a Solid Sprite
My platformer sprite in Construct 2 works normally aside from it not colliding correctly with platform sprites that are solid, as it goes through them until the platform is not quite halfway up the ...
0
votes
0
answers
43
views
Physics2D.OverlapBoxAll misses small overlap
I have a tetris-like 2D game with tiles, each made up of a sprite, a Rigidbody2D and a BoxCollider2D.
The tiles fall from the ...
0
votes
1
answer
91
views
Physics.OverlapBox not detecting 2D collider objects
I have a 2D game with several square objects (tiles) that each have a BoxCollider2D and a kinematic Rigidbody2D. I want to detect when one tile is located to the right of another tile, such as to ...
1
vote
1
answer
191
views
falling and clipping through terrain
I found this bug in many big games and never expected to find it in my small game. Basically, while running around carelessly, you suddenly clip through the terrain and fall endlessly.
I momentarily ...
0
votes
1
answer
110
views
How to check if a 2D GameObject is touching something without OnTriggerEnter
I want to avoid using OnTriggerEnter2D because I want to use it in a function like this:
...
0
votes
1
answer
36
views
Circle collider disappears after OnTriggerEnter
I have a 2D circle collider with "Is Trigger" set to true. Currently, all I have it do is play an animation (on just the sprite) and set a bool when the trigger is hit:
...
0
votes
1
answer
28
views
How can I check which of an object's colliders was touched during a collision?
I my game, I am trying to create a door/loading zone system, in which a GameObject has several loading zones as children, each with triggers as components. Also attached to each of the loading zones ...
0
votes
0
answers
37
views
Problem with physics object tunneling using Nez and monogame
I was using the Nez engine with monogame to create a platformer, I made the player character an ArcadeRigidBody and the map collision shapes were handled by a TiledMapRenderer, but I noticed that when ...
1
vote
1
answer
129
views
teleportation...how to not teleport inside walls
when the player uses the teleportation skill, he is instantly teleported X distance in the direction of movement so front, back, left and right depending in which direction the player wants to go.
the ...
0
votes
0
answers
18
views
Two moving and rotating bodies, how to approximate hitbox of a trajectory of a point on one body in the coordinate system of other
The game is in 2D.
Let's say I have two bodies: A and B, each with position, angle, velocity vector, and angular velocity (I'm not sure yet if I should be using angles, or rotation matrices).
Given a ...
0
votes
0
answers
53
views
Сollision detection c++
In the cube class I have its position and rotation. Also I have a collision check function:
...
-1
votes
2
answers
78
views
Destroying game object destroys additional object
I am building a simple hyper casual game and faced a strange issue when destroying one object destroyes another not related object.
As you can see when white cube collides with black rectangle, cube ...
0
votes
1
answer
72
views
Physics.CheckSphere not accounting for changes to object transform
My current project is a turn-based board game in Unity. Here is what I am trying to accomplish and the issue I am having:
In Start, I generate the board, then populate the surrounding area with ...
0
votes
2
answers
58
views
Display image by using tooltip
I want to display the image using a tooltip. So when I point to the 3dobject, it will display the image that I already created. Right now I already set the sprite in the tooltip but I have an error in ...
0
votes
1
answer
333
views
How to check if one object's local bounding box contains another
I am currently trying to check whether the first object contains a second.
I first tried to use the bounding box, but it is defined in world space, so it is not working with my rotated cubes.
Then I ...
0
votes
2
answers
103
views
How do I detect collisions with a circle sector against basic geometry?
For the 2D game that I'm building, I want some entities to be able to use areas of attack, such as a wedge/circle sector area of attack.
In this case, the circle sector is a pie-slice shaped section ...
2
votes
1
answer
168
views
How do I make AI avoiding obstacles on tile map?
I implemented 2 NPCs chasing the character using Dijkstra algorithm for pathfinding. Tile map is represented by graph, where a node is basically the tile, and the adjacency list consist of adjacent ...
0
votes
0
answers
39
views
IsTouchingLayers() does not detect collision
I'm making a tile-based player controller for a top-down game that first throws out a "move point" transform to see if its path is clear, then moves to it if the move point does not collide ...
1
vote
1
answer
126
views
Player body getting stuck between static bodies
This is a self-answered question. While it might be pretty obvious, this still catched me by surprise, so I believe there is some value in this Q&A.
There is a player-controlled ...
1
vote
1
answer
212
views
Increment score when player touches a coin's Area2D
I have created and finished my game in Godot, but I want to add a scoring system. Specifically, I want the score to increase by 1 every time the player touches a coin. However, I am not sure how to ...