I’m currently working on a game that’s similar to Super hexagon, and requires controlling 2 cubes through a maze or randomly spawning objects.
I currently have a collision detection system by placing 4 gameObjects on the cube that fire rays in multiple directions. If the ray collides on the sides of the cubes, it stops the cubes movement.
Because of the speed of the cubes movement, the cubes sometimes stop their movement when they’re already in the obstacle, not before.
I’m sure this is happening as the cubes movement is being processed in the same update frame of the raycast check, meaning that the raycast stops the movement too late.
I currently have the lovely script “DONTGOTHROUGHTHINGS” attached to the objects, but this still isn’t solving my problem. Essentially, I want to make sure the cubes never intersect inside of another object.
Should I be storing the cubes previous location as a vector, then push it back to that location if its detected to be in another object? and if so, how would you go about doing this?
Many thanks for any help that could be provided.