-
Name 2 methods for detecting collisions in a game.
AABB (axis-aligned bounding box) and ray-casting -
Describe roughly how they work.
AABB - checks for the superposition on the objects bounding box (only detects)
RC - projects a line from a given length of an object and check if it goes through anything (anticipates)
Pls what is ray casting
Hello @Michael_kelvin
Quick way, see previous posts from other students for rich answers.
With kind regards
-
Name 2 methods for detecting collisions in a game.
-> AABB and ray-casting -
Describe roughly how they work.
->AABB - active when two object overlaps betwen they
-> RC - calculate distanze in px between two object, and active when distance uqual to zero ,
(anticipates collision)
1
AABB and ray casting
2
AABB
when objects collide the object is set to new position used for rectangle object
ray casting
uses rays to predict collisions calculates how far the object is from another object
- AABB, raycasting
- AADB - detect the collision by detecting if the bounding boxes of the 2 objects are overlapped
Raycasting - project an imaginary line from an object to another object, and that line measures how much distance it has between those two objects
-
Name 2 methods for detecting collisions in a game.
AABB = Axis Aligned Bounding Box
Ray casting -
Describe roughly how they work.
AABB
In this algorithm we only check for the superposition of the game objectsâ bounding boxes. The boxes or rectangles are always alined with the X and Y world axes. Collisions are detected at the very frame they happen. This algorithm is ideal for games that only need rectangular colliders.
Ray casting
The priciple of ray casting is simple. We project a line with a given length from an object in the desired direction and check if it goes through anything. This method is all about calculating distances between objects.Rays are very precise in determining the exact distance between an object and the closest edge to another one. For example you can determine the exact distance of an object to the ground. Ray casting allows you to anticipate a collision, while AABB only detects collisions at the very frame they happen.
-
Name 2 methods for detecting collisions in a game.
AABB = Axis Aligned Bounding Box
Ray casting -
Describe roughly how they work.
AABB basically applies a rectangular hitbox on an object. When a colission is detected, which happens in the frame of the colission, the object is move to the closest point where the two objects aren´t touching and continues with the correct response from there.
Ray casting means that a moving objects casts rays which detect the distance to the objects around it. Here the colission is detected before it happens.
- AABB, Ray Casting
- AABB is working by âmonitoringâ rectangle (outside) borders of an object and Ray CasT is âshootingâ a rays in all directions from the object and can so detect possible collisions upfront and more precise
- AABB - checks object superposition if it is colliding with rectangular boxes. It only detects when objects are in collision.
- Ray casting - from objects are casted rays to all directions, if they go through another objects it calculates the distance and we know if objects are about to collide or not. It detects all possible collisions all the time.
1.Name 2 methods for detecting collisions in a game.
2 methods for detecting collisions:
AABB - Axis Aligned Bounding Box
ray casting
2.Describe roughly how they work.
AABB - Simple and lightweight, checks superposition of game objectâs bounding boxes, which are always aligned with the X and Y axis.
Ray casting - project a line with a given length from an object and see if it goes through any other object. Calculates distance between objects.
AABB: each element is contained in a box and when these boxes collide the program knows
Ray Casting: as the element moves there is a ray extended and the program can anticipate collisions