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

Detect collision on explosion

I am creating spells for my game. The collision with a normal fireball works just fine, what I am trying to achieve is to have the player_2 getting hit when the ...
0
votes
0answers
26 views

Numerical errors in Player collision offset causing player to fall through the ground the next frame, how to avoid?

I'm trying to implement player physics with arbitrary objects, in this case, a bunch of cubes. I wanted to add a "floor" so in my cube collision function, I added the following following lines: <...
0
votes
2answers
171 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 ...
-1
votes
1answer
37 views

How to make wheelcollider not stutter when moving on high speed?

I have a wheelcollider attached on a rigidbody and i move the object using : "transform.position += transform.forward * speed * input.getkey(keycode.uparrow)" And when the speed increasing the ...
0
votes
3answers
60 views

Both Trigger and Collision BoxCollider2D

My Player sprite needs to collide with some objects and be unable to pass through them and in other cases detect when it passes through some object (e.g. some non-...
0
votes
2answers
42 views

Get Closest point between a Box 3D and a Point

I have a point A (x, y, z), and a Box: Center (x, y, z), Size (Width, Height) How to get the closest point in the box from the point A ? In Unity I can create a bound, and I can find the non-rotated ...
0
votes
1answer
36 views

Space game scene boundaries

I've been trying to add boundaries to my space game. I've been following this tutorial with a sphere instead of a cube, but every time I start the game and move or rotate my ship it appears outside ...
3
votes
1answer
180 views

Quadtree for AABB collision boxes

I have a whole bunch of entities constantly being processed and testing for collisions. I've tried to optimize this by stopping certain entity types from checking each other, dead entities not being ...
0
votes
1answer
53 views

3D Collisions - Walking below a slope pushes me through the floor

Here's a really short video (less than 30s) of this issue : https://www.youtube.com/watch?v=JrKbpTY8cMU When I move the player towards a slope (the player is below it), it pushes the player inside ...
0
votes
1answer
58 views

Box2D Weird collision behavior

I'll let the gif speak first. As you can see, the small cube just kinda floats there like it has a forcefield. This weird glitch only happens with small cubes, smaller than 60 pixels for some reason. ...
0
votes
2answers
115 views

How to handle objects at the edges of spatial partition cells?

A lot of games store object positions as floats and have a closed ball for the game area (eg. a rectangle and objects are allowed to have position coordinates on all 4 edges). However, this becomes ...
0
votes
1answer
42 views

why child class can access object while parent can't

I have Block class which is the parent and StandardBlock the child , the prefab block have StandardBlock script attached to it, and according to my small knowledge in inheriting I though this would ...
1
vote
2answers
102 views

How To Resolve Collision Before it Occurs

I have 2 objects, A and B, in a 2 dimensional space. If I know A is trying to move by vector M (that is to add vector M to the positional vector of A), and that A will collide with B after A moves, ...
1
vote
1answer
70 views

Using logic gates for Sprite Collision Detection - humor an old fart please

Im an old coder who came back so to speak, learning Java I know what I want but I cannot find anyone asking it anywhere so here goes... Im writing a basic tank game to code for practice but as is ...
1
vote
1answer
27 views

The collision log is displayed only for the original obstacle and not for the duplicates

This is my first game attempt and I'm trying to create a game where my player (a box) stops whenever it collides with an obstacle. However, the log for the collision is only displayed when the player ...
1
vote
1answer
54 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
0answers
45 views

Moving point (as line)-Polygon collision detection

i've reached a good point with my engine, with static/instant collision detection and callbacks in case of collision. By instant collision detection i mean: Object A moves from x1y1 to x2y2 Check if ...
0
votes
0answers
51 views

brick breaker game - object collision problem - ball get's stuck in corners

I'm working on a game of brick breaker and I've encountered a problem that I can't figure out. whenever the ball collides with the corners of the peddle it starts vibrating (it's Yspeed vector changes ...
0
votes
0answers
20 views

Stop the player to prevent it from being thrown away after collision

I'm trying to write a script where when the player (kinematic) comes up against an enemy he stops, jumps and gets dynamic again. The problem is that when it returns dynamic it is thrown away and does ...
0
votes
0answers
80 views

What is wrong with my collision detection?

I am trying to create a collision detection system between block using this code: ...
0
votes
1answer
119 views

What to do with collision detection?

I am able to get collision detection (CD) into my game but... what do I do with it? Do I push the player back to the last location? Something else? I am programming the game in C++ using the Irrlicht ...
0
votes
2answers
334 views

Dragging a Rigidbody2D without passing through obstacles

I have this body of code written for an object that needs to be an obstacle and another object that is draggable. I have colliders on both and a kinematic rigidbody on the draggable object, but the ...
0
votes
0answers
19 views

Keep my 3d player from jumping if he's not on the Ground [duplicate]

I'm making a 3d game, and I have only made games in 2D before, but i have used blender before too. My player can now walk and jump, but he is not limited to only jumping of the ground. In 2D, you ...
0
votes
1answer
35 views

How to construct this collision vector?

I have a 3d game, but for movement I use only two axes (X and Z) - X is vertical, Z is horizontal Here's what I'm trying to achieve: Player is the circle, InputDirection is Blue, NewInputDirection ...
0
votes
1answer
32 views

Character blocking when walking on cube edges

I have my character walking on a ground made of cube. (scale 1,1,1). There is no space between them. Also, I have a RigidBody with 15 drag and I'm moving with <...
0
votes
1answer
65 views

Collision detection and solution causes teleportation on corners

I am making my own game engine on Python and I got stuck with collision between objects. ...
0
votes
1answer
138 views

OverlapBox() dimensions are huge but are fine when tested in isolation

To be completely transparent, I more-or-less copied this question from the Unity forums since I did not get a reply. I'm creating this system where I'm placing level chunks together and I need to ...
0
votes
1answer
19 views

Top-down 2D push angle velocity

I'm trying to determine the angle NPCs are pushed in when the PLAYER collides with them, like how 'Retro City Rampage' and 'Shakedown Hawaii' do when you bump in pedestrians. Here the PLAYER (green) ...
0
votes
0answers
47 views

chunk based collision

I have been trying to figure out why my collision tiles act so strange; I put I collision tile above a normal chunk based tile but it seems to not work - the collision tiles seem to appear in the ...
0
votes
2answers
105 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 ...
4
votes
1answer
257 views

Making a wrapping wire (like the Worms Ninja Rope) work correctly with moving geometry

I have implemented a 2D wire like the one described in this question which is made up of straight line segments between wrapping points. However, while the algorithms described in this answer work ...
0
votes
0answers
55 views

Pygame Mask Doesen't Detect Collisions

I'm trying to make my game's collisions with masks. I have 6 masks but only 2 works. My code is: ...
0
votes
2answers
98 views

OnTriggerEnter With First Person Controller

I'm working on an FPS for my first time. I'm creating a simple terrain and instatiating 15 cubes on my terrain. (This works fine). Each cube is named "cube" and has a static trigger collider. Here's ...
0
votes
0answers
21 views

Collision2D on sprite child (sword of char) does not detect collision on tag == enemy

Problem is in the title. The sword sprite is a child of body which is a child of my char. Sword and Char have collider and rigidbody, and if the char and enemy collide, it works. But it does not ...
1
vote
1answer
40 views

How to prevent/“reverse” displacement from a collision?

In my game I can throw a hammer. The hammer moves based on physics in Unity. The hammer destroys the first object it touches. I want it to continue moving as though it didn't touch anything when this ...
0
votes
1answer
43 views

Why do my objects with colliders go through each other, and how do I fix it?

I am new to Unity and I am just experimenting with a player controller script (which I got off youtube) and another object which doesn't move. Both my player and the stand-alone object have colliders ...
0
votes
0answers
65 views

Box2D with SDL2 not working properly (Collision without rotation and problems with MKS)

I already have some expirience using SDL2 so I thought I will add a Physic Engine to my game - I chose Box2D. I managed to setup everything and to build a small program using SDL2 and Box2D. But now ...
0
votes
0answers
32 views

Odd Behavior with Simple Collision Detection Between Moving Objects, Rectangle Method

Solution Update After tinkering around a bit, I noticed that my bounding boxes were not updating in accordance with the movement of their respective objects, so it struck me that I should put the ...
1
vote
1answer
76 views

Unity Collider2D is causing the game object to disappear upon collision

I have gone through just about everything to try and isolate this bug. I have isolated it down to the enemy collider, but have not solved the issue. When my player collides with my enemy, the enemy ...
0
votes
0answers
23 views

Unexpected collision between two gameobjects [duplicate]

I can't find out why my Cube gameobject sometimes collides on transition right between two gameobjects (blocks), which are the same height, material and so on. See the gif below (note, the colors are ...
1
vote
0answers
80 views

Where and how should I check for collision in multiplayer game?

I'm making a multiplayer game. For now, I added a script to towers and I have booleans to change using OnTriggerEnter. When triggered, client sends a message to server and towers health starts to get ...
0
votes
0answers
31 views

Unity3d:Detect a collision between an image and a sphere

So, I just realized, an image with BoxCollider2D wont detect any collision with Sphere with <...
0
votes
1answer
39 views

How to make character not enter the platform when colliding on the side with the platform?

I had a problem with detecting my character's collision with the enemy being detected in 2 ways: side by side when it (character) jumps into the enemy's head. I imagine it to be basic, so I figured ...
1
vote
0answers
41 views

Problem with collisions detection on canvas platformer

Having a lot of trouble with my collision detection in my platformer. If you go straight to the right the block will float. Also the corners let the block sink right through and the walls are sticky. ...
1
vote
1answer
50 views

Is there a name for this algorithm for 2d shape collision?

A while ago I was considering my possibilities for implementing collisions between 2D shapes, and after much googling (which mostly turned up SAT), I came up with this: ...
3
votes
1answer
40 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 ...
0
votes
0answers
66 views

How to create polygonal or elliptical colliders by python tkinter?

I am developing a primitive game by python tkinter (I use canvas). It's not a big project. It's only my own self-challenge to create a game using only tkinter and standard python libraries. My problem ...
1
vote
1answer
129 views

Monogame - Collision not working and invisible walls

I have recently been experimenting with Monogame and XNA (moving from Gamemaker) and decided to work on a simple collision system. Problem is shown in the GIF. Main Collision Each entity (Quick name ...
1
vote
1answer
45 views

Find the co-ordinates of collided objects in Python

I have a group containing my aliens and another containing the bullets I have fired. When I detect their collisions, I want to pull the alien's x-y co-ordinates during it's deletion so I can put an ...
0
votes
0answers
19 views

how to find point intersection of two segment in 3d after they collide? [duplicate]

I'm working on collision boxes project and I found a problem that when I detect the collision with the algorithm of SAT and knew that the collision was edge\edge I couldn't find the the point of ...

1 2 3 4 5 44