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
0answers
30 views

SFML Separating Axis Theorem collision detected outside shape

Trying to implement the SAT in SFML using SFML's ConvexShape. Some shapes, like rectangles, seem to work but others trigger the collision outside the shape. I tried drawing the normals, or the axes ...
0
votes
0answers
24 views

The world crashes after reset

I have this PyBox2D script, And I want all the bodies to destroy and then reset when a Car hits a building. The collision detection works well, so does the destroying of the world, a problem occurs ...
0
votes
1answer
43 views

2-D character not falling to the ground

I am very new to Game Development and I am making a game with a simple Ragdoll which has a body, a head, and 2 limbs(hands). The head and the limbs are hinged to the body and I have kept the Ragdoll ...
0
votes
0answers
44 views

Pong paddle and deflection angles

I'm trying to make a pong clone and am having trouble grasping ball deflection. The way I'm approaching it is to increase the angle by how far the ball collides from the middle of the paddle. However, ...
1
vote
1answer
30 views

Raycast check for Collisions across XZ coords without Y rotations / Unity C#

I'm really new to Unity/C# (I have a bit of experience in GML but far from professional) and I am currently building out my first prototype. I originally copied THIS script to get a cube that rotates ...
0
votes
1answer
36 views

Why aren't the Physics2D.Raycasts reliably colliding with the 2D Box Collider walls?

I've got this NPC walking around and I'm trying to create a cone to represent their line of sight, including how it would be blocked by buildings, similar to how Nicky Case has implemented it as ...
0
votes
2answers
73 views

Is it possible to detect a collision between a sprite and a UI image in Unity?

I have a stationary sprite with the tag "Player" with a Rigidbody2D (dynamic body type and discrete collision detection) and circle collider 2D. I also have a moving UI image; also with a Rigidbody2D ...
0
votes
1answer
57 views

How to make a teleporter in unity3d?

For my game, I need to teleport player (GameObject) to a position (Vector3) whenever it touches a cube with this script. I tried ...
0
votes
0answers
18 views

Setting the position of a Rectangle does not always work in libgdx

I'm experimenting a little with libgdx and I'm trying to use it to create a little android game. Everything goes well until I try to correct the player position when a collision occurs. This is the ...
0
votes
0answers
35 views

Why are my colliders offset on my isometric map?

I'm building an isometric environment in Unity and having some trouble with my colliders aligning with what shows in the scene editor to the reality in gameplay. There is nothing in the collider ...
1
vote
1answer
28 views

How to prevent OnCollisionEnter2D calling a function again and again?

My current code makes a ball keep jumping whenever it hits the ground. But when it hits a vertical ground it keeps calling the jump function again and again. That is because OnCollisionEnter2D makes ...
0
votes
1answer
123 views

Can a GameObject be both 2D and 3D?

In all Unity games I saw so far, every object is either 2D (with RigidBody2D and Collider2D components), or 3D (with RigidBody and Collider components). This makes sense, but I wonder if there is any ...
0
votes
0answers
20 views

Collision between a static collider and a rigidbody collider [duplicate]

I am trying to understand the Unity rules for collision detection. In particular, the manual says that a static collider touching a rigidbody collider should lead to a collision. So I did this: ...
0
votes
2answers
53 views

How to not move my character when they collide using Unity and Box Collider?

I'm trying to get my characters near to each other so they can attack the other one, but when the player character or otherwise gets near they are pushed to the other direction when they collide. How ...
0
votes
1answer
84 views

Unity's Box Collider isn't preventing an object from falling through the floor

I'm working on a little "Tower of Hanoi" AR game in Unity using Vuforia, where the game is projected onto an image target. Now I wanted to make the rings "fall" into place, so I added an invisible ...
0
votes
0answers
24 views

Pushing an object on other colliders makes the pusher object go through

The Wall moves to the right and pushes the Character with it. The character travels along a bunch of Blocks with colliders attached to them. This is the result: At some point, the Character gets ...
1
vote
0answers
27 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
1answer
66 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
28 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
36 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
1answer
53 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
56 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
13 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
71 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
85 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
88 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: ...
1
vote
1answer
47 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
64 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
97 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
123 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
47 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
29 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
19 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
54 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
27 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
147 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
19 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
25 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
34 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
34 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
46 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
62 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
350 views

Unity 3D move kinematic rigidbody

I'm trying to move a kinematic rigidbody (a spaceship) with this code: ...
1
vote
1answer
121 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 ...

1 2 3 4 5 44