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
1 answer
43 views

Rectangular Collision Resolution behaving incorrectly on corners

I'm currently writing a simple game engine and encountered an error while trying to resolve rectangular collisions. When an object moves diagonally and collides with a solid object I only correct it ...
user avatar
2 votes
1 answer
139 views

Efficiently find all points within a circle

I am writing code that requires me to find all points within circle on certain parts of the screen hundreds of times per frame. I wrote a quadtree for this and have 1 method called query_circle that ...
user avatar
0 votes
0 answers
29 views

How to change the alpha of a tilemap if the player is in it in Unity

I'm working on a 2D game and would like to have it so when I'm entering a building, the roof fades away. This is my current attempt, I'd just like to know how to set the alpha of a tilemap through c#. ...
user avatar
0 votes
1 answer
52 views

Efficient way to check collisions for many objects

I am making a Bloons tower defense game and I came across a problem with regards to collisions. The way my code currently works is all the current bullets on the screen(could be potentially thousand) ...
user avatar
0 votes
1 answer
56 views

How to resolve swept AABB collision when two boxes are hit at exactly the same time?

I've read many posts here about sweeping AABB collisions and the corner problem. But I still couldn't solve the problem. In the image below, the object starts touching both boxes, and when I apply a ...
user avatar
-1 votes
1 answer
103 views

javascript top down circle to circle smooth collision detection

I've been looking through a lot of answers here: Resolving Circle-Circle collision Circle to Circle collision, checking each circle against all others Nestling into contact with a group of physics ...
user avatar
0 votes
0 answers
27 views

Unity - Circle Collider 2D traveling the side of a wall randomly collides with wall corner

I have a 2D golf game that uses a Circle Collider 2D on the ball, and I have levels/holes built out in Tiled, which I import into Unity using SuperTiled2Unity. Being a somewhat retro styled pixel art-...
user avatar
0 votes
0 answers
40 views

2D circle and rotated square collision detection and response

I'm creating a 2D multiplayer game in javascript, but I'm actually struggling with a problem (not really a problem, but I don't know how to do). I'm actually trying to make my player (circle hitbox) ...
user avatar
-2 votes
2 answers
56 views

Collision callbacks not working

I'm a beginner at coding and wanted to make a quick little program to test my googling skills so far. I'm trying to make the player GameObject be given a speed boost when it collides with the "...
user avatar
-1 votes
1 answer
74 views

How to detect objects within a radius without using a trigger collider?

I want an object to run code that detects objects around them, in a specific radius. BUT I cannot use a trigger... or any game objects or components. What could I do just using code?
user avatar
0 votes
1 answer
75 views

Detect Child Trigger inside Parent Script

I want to detect when a Child's collider is being triggered to apply the damage to the thing being hit. But currently I'm confused about how it works. Does the Parent's ...
user avatar
  • 3
0 votes
1 answer
112 views

How to implement a directional attacking/blocking system?

I'm working on implementing a directional attacking / blocking system in Unity à la Elder Scrolls: Arena or more recently, Mount & Blade - where moving the mouse in a certain direction signals a ...
user avatar
0 votes
1 answer
73 views

How to properly set up a lives system for a side-scroller in pygame

I have a game where the player has to dodge asteroids coming towards it, and I would like to incorporate a life system. Unfortunately, when I tried this, it still killed my player immediately. I ...
user avatar
0 votes
0 answers
20 views

Collision not being detected on CharacterController in Unity

Help! For whatever reason, I was following a tutorial on Unity movement, and when I was going to test out collision for certain objectives in my game, for whatever reason collision is not being ...
user avatar
0 votes
0 answers
22 views

Virtual Camera with Collision

I am using a VirtualCamera2 Actor for recording sequences using iOS devices + Xbox Controller as input devices. Everything works well except for collision. I tried to add it in many ways but it doesn'...
user avatar
0 votes
0 answers
59 views

line renderer collision detection in 3D

I've been using the code down below to simulate a rope physics (based on this: Create Rope Bridge, String in Unity - Verlet Integration Part 2). Currently, it uses edge collider 2d to detect collision....
user avatar
2 votes
1 answer
178 views

Godot: is_on_floor always false

This is an extremely simple game (following tutorial). My code and configuration allows the actor object to fall on a platform made of tilemaps and not fall through, but the function is_on_floor() ...
user avatar
1 vote
0 answers
80 views

Wall sliding collision resolution with multiple objects

TLDR My collision resolution algorithm with wall sliding works perfect for multiple walls but it fails when the angle of the corner of two walls is less than 90 degrees. (acute angles) and the player ...
user avatar
  • 115
0 votes
1 answer
53 views

Detect if actors are inside another actor with custom shape

I have few actors with custom, non convex geometry (mesh) created using PxRigidActorExt::createExclusiveShape and a lot of actors with ...
user avatar
  • 111
3 votes
1 answer
164 views

Unity CharacterController steps on colliders with 0 Step Offset

I'm moving my CharacterController with the Move() method and for some reason it still steps on colliders even though its Step ...
user avatar
  • 649
0 votes
2 answers
97 views

How to reconcile collision detection with delta time?

In my simulation, if an object is inside another object, it imparts a force proportional to the distance inside the object (basically a separation force). I am having an issue though where the ...
user avatar
0 votes
0 answers
51 views

What is the most efficient way to detect collisions of a large number of similarly sized objects?

Also, the maps are around 4000x4000 (pixels) So, all the objects in my game are 2D circles, and they all have a radius of between 5 and 10 pixels. My current solution is to use a spatial hash where ...
user avatar
0 votes
2 answers
97 views

How to efficiently do one-to-many collision checks?

Scenario: 4 players, each can have from 1 to 100 pawns. I want to be able to efficiently check if Player 1's pawns collides with Player 2, 3, and 4. Currently I have an AABB check, done first on ...
user avatar
  • 15
1 vote
0 answers
65 views

2D tilebased collision system

Hi i want to implement a collision system (something comparable to super mario) I would like it to have objects which can have any size (the hitbox of it) And it should be reasonably efficient (so ...
user avatar
  • 11
2 votes
1 answer
42 views

Problem with bullet colliding with multiple enemies instead of one

I have a bullet script that trigger on collision with an enemy, problem is when two enemies colliders overlaps and trigger with bullet both disapear instead of one only. Is there any way to only ...
user avatar
0 votes
1 answer
79 views

Godot KinematicBody2D Invisible After If Statement

The reason I address this question is because of the limited documentation and support for starting devs on Godot. I do not know what is wrong with this one if statement, but after I added it, my ...
user avatar
0 votes
1 answer
106 views

How to make a capsule Rigidbody player "kick" a Rigidbody sphere (ball) in Unity?

I am just learning the basics of physics simulation with rigidbodies. I am trying to simulate some basic real world functions like kicking a ball. Let's say I have a simple capsule mesh/collider as my ...
user avatar
  • 237
3 votes
2 answers
285 views

How to differentiate between enemy and something else in Godot?

So, I have a simple 3D game with a player, an enemy, and walls. I've figured out how to detect collisions between my player (RigidBody) and an enemy or wall (Static Body). I want to know how can I ...
user avatar
1 vote
1 answer
69 views

DooM P_BulletSlope function , how does it works

I'm trying to understand how DOOM source code works, the problem is I don't understand a few things, why is it 16 * 64 * FRACUNIT ? , i don't get it. ...
user avatar
  • 111
0 votes
1 answer
60 views

In a portal-based engine where Items are owned by a room, how to do inter-room collision detection?

My engine consists of Rooms. Rooms are connected via Portals. Items have a roomNumber field to indicate which room they belong to. And rooms have a linked list of ...
user avatar
  • 641
1 vote
1 answer
133 views

How can I tell if my raycast hit a tree?

I have a TerrainGridSystem grid on a forested terrain. The grid system draws a grid onto the terrain to set up a game board. I want to find all the trees and mark ...
user avatar
0 votes
0 answers
13 views

Unity3D object falling from high are passing through ground [duplicate]

First, you can see the bug in action here: https://www.youtube.com/watch?v=vqbo3rweEmA When rigidbody objects are falling from high position (300 in my test), the ground collision doesn't works, the ...
user avatar
  • 101
5 votes
2 answers
1k views

RPG - How to deal with the collision of a sprite with a side-view thinner than its front-view?

I am currently working on a role-playing video game featuring sprites that take the form of antropomorphic objects. These sprites can move around in the four cardinal directions, and turn to face the ...
user avatar
  • 53
1 vote
0 answers
231 views

No Collision while rotating. Object rotating with Rigidbody.Rotate passes through other collider

I'm working on a 3D game, and having issues with the colliders. My Cube Controller has movement input by keyboard, with collider and rigidbody components. Cylinder objects have basic colliders and ...
user avatar
  • 11
0 votes
0 answers
16 views

Is there a lighter way to implement "object stops when hit wall" without relying on Dynamic gameobjects in Unity3D (2D)?

I am currently using a Dynamic GameObject for my entities, but I feel as if that will risk slowing down the game on weaker hardware (especially when there are hundreds of entities). Not only that, but ...
user avatar
  • 1
0 votes
0 answers
149 views

How to display ray collision object with Ray Perception Sensor 3D Unity ML-Agents

I try to detect collisions with the Ray Perception Sensor 3D from Unity ML-Agents. I read that collisions with colliders through the rays will be automatically added to observations. How can I display ...
user avatar
0 votes
1 answer
88 views

How can I make a hitbox around my image?

I'm really new to PyGame and trying to program a game, and I can't figure out how to make a hitbox that when this image hits the edge, the game stops it from going past the edges ...
user avatar
1 vote
1 answer
209 views

How do I get OnTriggerStay2D to consistently work in Unity?

(2D Project) I have a very basic set-up in which I have a Hallway with a door and a bunch of other objects. I have a player that starts on the left side of the hallway and only moves on the x-axis. ...
user avatar
1 vote
1 answer
84 views

UE4: How to make UProceduralMeshComponent a solid body, not just a surface around volume?

I generated the UProceduralMeshComponent and set collision enabled to ECollisionEnabled::QueryOnly. But I get ActorEndOverlapEvent if I stop touching the mesh border even if I still inside of mesh ...
user avatar
  • 241
0 votes
1 answer
53 views

My character runs around on their own after picking up an object

I have a weird bug on my hands. I am trying to create an event whereby the character walks into an object and automatically picks it up once the collision occurs. The character can pick up the object (...
user avatar
  • 1
0 votes
1 answer
51 views

how to detect a 2d box collission with 3d box colliders

I have a bunch of TextMeshPro labels in a scene at various x,y,z positions and I would like to detect when labels overlap from the camera's perspective so I can keep the labels from stacking. The ...
user avatar
  • 191
0 votes
1 answer
60 views

Sliding character inside the circle

When it comes to rect against rect smooth sliding movement, that is easy. Something like this will work ...
user avatar
0 votes
0 answers
37 views

Get all the objects which are involved in a collision (exactly) in Unity with C#

How can I get exactly all objects which are involved in a collision? The objects which collide in my case containing of several childobjects from which I need to know which of the childobjects is ...
user avatar
1 vote
0 answers
145 views

Smooth collisions with a triangle mesh

I've got a ground mesh which is comprised of a collection of triangles. When the box moves along the surface it sometimes collides with the internal edge. The way I'm handling collisions for each ...
user avatar
0 votes
0 answers
30 views

Javascript Game Collision Shaking

I have a problem with collision shaking. The problem doesn't come from the collision, but from client side (sometime the it's smooth and sometimes not). Here is a video to show it : https://www....
user avatar
2 votes
1 answer
101 views

How can I keep a node in-place while I re-parent it?

I have an object that needs to follow various Path2D paths in my scene. To do this, when it needs to follow a path, I re-parent it to a ...
user avatar
  • 1,115
0 votes
0 answers
53 views

Sphere collision resolution when colliding with multiple meshes

I'm writing my own player collision physics and I'm stuck at collision resolution part. I have sphere as a player and scene made of static meshes. Collision resolution works fine when player is ...
user avatar
0 votes
1 answer
45 views

BoxCollider2D used as reference to Collide with GameObjects but it uses the original size Sprites size to Collide

I'm a beginner in Unity and pretty much copy and pasted the code but I can't figure out why the game is using the size of the sprite and not my BoxCollider2D as a ...
user avatar
0 votes
3 answers
276 views

Why am I getting Null Reference Exception inspite of checking if the Object is not null to execute something

Hi I am just trying to convert a simple flappy bird game into multiplayer game. So In the multiplayer game using Photon , I want the bird to collide with the ground or pipe but not with the enemy bird ...
user avatar
1 vote
3 answers
904 views

Unity2D Grid-based Sprite Movement and Tilemap Collision

I have just started working with Unity2D to simply learn how it works. I've been trying to get grid-based movement and collision with a tilemap working, and it's mostly there, but there's one bit that'...
user avatar

1
2 3 4 5
48