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
votes
0answers
34 views

Formula for Sphere - Sphere collision detection

I need to know the full formula for Sphere - Sphere Collision Detection for Game Physics Assignment, I would just like to know if this is correct what I have so far, don't mind the commments ...
0
votes
0answers
14 views

How to calculate when a shot hits the opponent from behind?

I'm making a game where the enemy can turn on its own axis in 360 degrees (top view game). The player-controlled character has a bow. With this bow he shoots and deals damage when he hits the enemy. I ...
1
vote
1answer
29 views

Pygame logic to make a player stop at obstacles without overlapping them

what's the best logic to force the player to change its direction when he's just next to an obstacle (building, rock, tree..) ? I know this is related to collision detection but maybe my logic isn't ...
1
vote
0answers
26 views

Why does Lerp not reach target if setting rb.position, but setting rb.transform.position works?

I don't understand the logic here. I have the following script which makes a player jump towards a target: ...
2
votes
1answer
45 views

Can't check collision between a mask and a rect in pygame

I'm new to using masks in Pygame and I'm having trouble with them. I have already learned how to check collisions between two masks but I'm wondering about an effective way to check collisions between ...
2
votes
0answers
43 views

2D game make precise collisions

I am currently creating a personal 2D tile map game in Java. This is the first time I have attempted to make any sort of game, so I don't have a lot of techniques known by experienced developers. ...
0
votes
1answer
23 views

How can I create a good physics colliders for these models in Unity3D

I need to make a 3D colliders in Unity with those forms. I don't want to use any Asset Store asset if it's possible. There are two models: both are cylinders but they have some deformations (see image ...
0
votes
0answers
14 views

Unity OnTriggerEnter2D doesen't check Z Axis

I am coding my game's collisions using onTriggerEnter(). The problem is that it only checks X and Y axis and not the Z one, and that is causing me some problems ...
0
votes
0answers
18 views

How can I “tilt” my grounded raycast?

I'm working on a 3D game with a spherical collider for the player. My ground check looks like this, where I'm currently hardcoding Vector3.down as the direction: <...
0
votes
0answers
15 views

Player catches on tile map collision, even with common fixes

I am making a simple 2D platformer in Unity. I have a tilemap and I started noticing that the player catches on the tiles during gameplay. I move the player using ...
1
vote
0answers
51 views

How do I reference specific child objects in OnTriggerEnter2D

I'm currently trying to check if child objects, whose parent is running the script, are colliding with things. It doesn't matter what they're colliding with on the layer, I just want to know which of ...
0
votes
1answer
45 views

Issues using Physics2D.Linecast for Movement Collision

It's quite possible I'm missing something obvious (I'm still rather new to this) despite checking the documentation, but I'm at my wit's end with this issue. I'm attempting to add simple linecast ...
2
votes
1answer
102 views

Floats vs. Ints for position and collision

So I’m writing a player class and using floats to store the positon and velocity (Vector2) as well as using it when drawing. When it comes to collision I get the player bounds using this code: ...
0
votes
1answer
20 views

How to detect all vertices within collision Area?

Using collision detection algorithms such as MPR (Minkowski Portal Refinement), GJK (Gilbert–Johnson–Keerthi distance algorithm), you can calculate the penetration depth in the collision. For 2 mesh ...
1
vote
1answer
13 views

Pygame some methods aren't working properly (collidepoint and get_rect)

I'm making a game menu in Pygame, consider the following block of code: ...
0
votes
0answers
9 views

one collider for 2 combined object

I have an obstacle that composed of 2 game object, but when the player collides it, it gets in OnTriggerEnter twice when the obstacle have 2 different collider, which is what it should be, of course. ...
0
votes
0answers
35 views

Sphere-ring collision detection

I'm making 3d basketball throwing simulator and I'm stuck with the sphere-ring collision detection. It's easy to find the collision normal if we have the collision point with the ring, but I don't ...
1
vote
1answer
54 views

What is get_bounding_rect() method in Pygame?

I got used to get_rect() when detecting collisions in Pygame but I've just discovered that another method called ...
0
votes
0answers
34 views

How to detect ray cast collision on terrain gameobjects?

I made a script were an objects shoots a ray cast facing on the vertical axis and detects were the terrain is and then moves to the current terrain height wherever it is. This is so I can spawn an ...
0
votes
2answers
96 views

Why can't the player walk properly on the moving platform?

I'm making a platformer with Unity. In one of the scenes, I have a moving platform that moves back and forth. The problem is that the player can't walk (or sometimes jump) properly on the platform and ...
1
vote
0answers
46 views

With Unity, why this character with a rigid body and child element colliders doesn't collide with the floor and go through it?

I got an issue with my character going through the ground and actually going through all other elements with a collider. I'm going to try and show as much as I can of the current state of things. My ...
1
vote
1answer
38 views

Instantiated entities don't collide with each other

I've started to learn DOTS some day ago, and decided to create a simple project. When I added some simple physics to the game I faced the problem. I added one object on the scene and another ...
0
votes
0answers
51 views

Box collider not colliding with Character controller

I have a player with a CharacterController attached. The player can move around. There are obstacles which the player can collide with. These obstacles have a ...
2
votes
1answer
114 views

Creating walls for a racing game?

I have the following kind of race track: As you can see some walls are talls but some aren't... Question: How can one create invisible walls so that cars stays in track? More exactly, how to model ...
0
votes
0answers
32 views

Unity Job System - Transform movement but checking collision with wall

I am trying to get this Unity Job System to work on my top-down shooter 2D game I am currently using transform.position to move player around. I can do it in the ...
-1
votes
1answer
43 views

How to stop player from slingshotting across my game window

In my pygame dungeon rpg when my player collides with a wall at the top or the bottom of its rect and I move the player in either x-direction, the player gets slingshotted off the screen. Using print ...
1
vote
0answers
76 views

How can I allow the rope to correctly interact with Box and Polygon colliders?

In order to build 2d rope physics in my game, I download the github project from Jongallant in this link. In my game, I want the rope to collide with objects with different types of colliders such as ...
1
vote
1answer
62 views

How could I simulate projectile collision agaisnt RTS units with primitive colliders?

For example, humans are easy they are just capsules. But for cavalry, an arrow could hit the horse or the rider. Right now cavalry are also capsule colliders for unit-unit collision, but for ...
1
vote
1answer
31 views

How to compute the points of a CollisionPolygon2D?

Godot v3.3.1.stable.mono.official I am trying to draw a CollisionPolygon2D programmatically but I cannot resize or write the ...
1
vote
1answer
25 views

Detecting a mouse click While in a Trigger

Why does the following code not working? (weird, sometimes it works sometimes not ) I want to move player by touching on the screen and change the color of gameObject when detect trigger and release ...
1
vote
1answer
24 views

Unity 'Collider.bounds.Intersects'. Does it handle rotation?

You will probably laugh at my code here (and I would love to hear some completely different approaches to this problem if possible), but I've written this myself using the only logic I could come up ...
1
vote
0answers
34 views

How would I implement a level transition when reaching a cave in Raylib?

I am the developer of an upcoming 2d/3dRPG. I have a simple scene setup where there is a bridge over some acid and a cave entrance-like thing that I want to change the level with. I have used C and C++...
1
vote
0answers
33 views

How to avoid CollisionShape2D bouncing which prevents Area2D detection?

Consider the player with a rectangular CollisionShape2D: and a round enemy with a CollisionShape2D and a little bigger ...
0
votes
1answer
22 views

Function destroying wrong object

I am using the collision_line_list function to detect all objects of a type. In this case, the object is obj_CapMan. Code: ...
0
votes
1answer
28 views

Why Query Only fires OnComponentHit? It supposes to fires only Overlap events

I've just started to develop with Unreal Engine 4.26.2 and I've been for five days trying to understand how collision works. I'm developing a Pong game, and I'm trying to make that the Ball bounces ...
1
vote
1answer
23 views

How to transfrom CollisionPolygon2D according to the Vertex Shader applied to a Sprite?

Consider this: * KinematicBody2D - * Sprite - * CollisionPolygon2D And a vertex shader: ...
2
votes
1answer
66 views

Does collision between two Area2D work differently than collision with Rigidbody2D?

Consider a Main.tscn with: (1) a player: + Player extends Area2D |_ AnimatedSprite |_ CollisionShape2D The player has: ...
0
votes
0answers
13 views

Unity 2d overlapCircle melee combat issue

I have an issue with my overlapCircle melee combat in the game. I'm not good at such things, so I just copied that code from some YouTube tutorial. But the thing is ...
0
votes
0answers
15 views

Snake game collision with wall and reset

So I have a collision with itself and collision with the apple. I just cant figure out how to get it to collide with the wall. What my teacher helped me with was it made it teleport to the other side ...
0
votes
1answer
137 views

How do I detect if my object is grounded?

I am trying to detect when an object is grounded. My script right now is: ...
1
vote
0answers
32 views

Tell if two polygons are colliding

I want to make a function like areColliding which takes two polygons as args. I also want to cover cases like and the dreaded because I am trying to create a ...
0
votes
0answers
13 views

How to follow an object with the player without stepping out the waypoint line Unity3D?

How to follow an object with the player without stepping out the waypoint line? I added four waypoints with a debug.line and tried doing some simple waypoint mechanic. I wanted the object to move from ...
0
votes
2answers
44 views

Coins are solid objects and I can't collect them

I am just starting out with Unity following along with this video, and I am stuck at roughly 1 hour and 54 minutes in: https://www.youtube.com/watch?v=pwZpJzpE2lQ It is worth noting that the video ...
0
votes
1answer
17 views

How do I resolve a collision in SAT-3D when the projection axis is zero?

I am doing SAT in 3D, right now just between cuboids/3D rects (idk the terminology). I have intersection working fully, and static collision works as long as the projection axis is not zero. But if it ...
0
votes
0answers
38 views

Having Problems in PyGame with Mouse Cursor and Sprite Collision

I know something is not right but I'm just starting out and hit a wall. Basically, I just want to MouseClick on a Sprite and make something happen. The mouse clicking itself works, the sprite ...
0
votes
0answers
44 views

How to perform a sliding collision between a square and a circle?

Please point me to the duplicate if this has been asked before. I couldn't find it. Basically, I am creating a 2d top-down game where the player is represented by a circle, and the tiles are ...
0
votes
1answer
32 views

Help finding bug in seperating axis theroem code

My collision detection is inconsistent. I am testing between 2 rectangles. When they are un-rotated, it says they are intersecting way before they touch, but when I rotate one, it works properly. I do ...
0
votes
0answers
19 views

Melee Range trigger collider does not detect object with Player tag

In my 2D game, I have a Player which has: a BoxCollider2D with isTrigger=false a dynamic ...
1
vote
0answers
43 views

How can I fix glitchy Collision on my 2D game?

Update: I fixed the Negative axis glitch but the Invisible wall glitch still exists I have made a 2D game in Java and I rewrote collision as I added chunks. I have been having problems with the ...
1
vote
1answer
64 views

player teleporting into other levels

So I basically want to load another map once the player collides with a object, specifically a "Portal" in my game. Which is really making the player move onto other levels. I don't want to ...

1
2 3 4 5
47