19/08/2017 – OBB Collision Point

  • Currently is set to output 0,0,0 so that teh point is set
  • when two cubes collide the corners that make up that collision seem to be incorrect
    • In some instanced a cube will have 7 corners in the collision, which is impossible
  • TEST: swapping the min and max
    • so that instead of a having a min value it will Have the Max value
    • Incorrect
  • Issue is that the first corner will always be the closest corner
    • So if the corners furthest away from the collision are processed first they are added into the collision
    • SOLVED by clearing the list of collision points for that object when a new closest projection distance is found
  • Debugging still doesnt look right
      • Vertical lines originate at the corners in the collision (pre-collision resolution)
        • Magenta are from cube B (pink)
        • Cyan are from cube A (Yellow)
      • Horizontal lines show the overlap of the objects along the collision normal
        • White is the collision normal from B – Could be incorrect fr the purposes of the debugging
        • Green is the maximum length along that line that a corner of B is
          • which is why it stops vertically below the magenta line
        • Red is the minimum length of A along that line
          • ISSUE that it does not stop vertically below the cyan lines
  • TEST each of the collision types for appropriate number of corners
    • 1v1 – corner to corner
      • Fail
    • 1v2 – corner to edge
      • Fail – uses corners on the wrong side of the shape
    • 1v4 – corner to face
      • Pass
      • SEE IMAGE ABOVE
    • 2v2 – edge to edge
      • Fail – uses the corners on the wrong side of the shape
    • 2v4 – edge to face
      • Pass
    • 4v4 – face to face
      • Pass

17/08/2017 – CORNERS SOLVED

  • After tinkering with the code for over two weeks
    • Matrix method seemed the most accurate and tehrefore the most likely to be the fastest to improve on
    • The corners were rotating too fast and on the world XYZ axis system
    • Problem was solved by:
      • Making the angles correct for the timestep
      • Rotating the corner into an axis aligned position
      • performing the rotation
      • Rotating it back into its original orientated position

15/08/2017 – Corner Code Review

  • Going over all rpevious written code to check for errors relating to the rotation of the corners
    • Applying a quaternion rotation works as epected.
  • Created Functions for normalising a quaternion
    • Including one for calculating the magnitude of a quaternion
  • Created functions for rotations of different types
    • Quaternion
    • Matrix4x4
    • Euler angles
  • With these new functions tested
    • Quaternion and matrix4x4 work as expected for a stationary object
    • Rotation matrix created from euler angles does not work as expected for a stationary object
  • Neither work with the current methods of calculating rotating objects

11/08/2017 – Obb Corners

  • Have no tried, using the following methods to rotate the corners of my cubes so that they can be used for obb to obb collision;
    • Matrix4x4.TRS()
      • then using Matrix4x4.MultiplyVector()
    • Quaternion rotaion using Sphereingcal linear interpolation
    • Quaternion rotation creating a quaternion to represent the angle of rotation that occurs between each frame
    • Creating a rotation matrix myself and applying that to the corners
      • 3×3 matrix for just rotation
      • 4×4 matrix for general 3d movements
        • can be used for
          • translation
          • rotation
          • scaling
          • shearing
          • projection

08/08/2017 – OBB corners and OBBvsOBB collisions

  • Swapped the implementation fo the OBB RotateCorners function to take in the orientation of the object instead of the rotational velocity
    • Appears to have fixed the problem of the corners not being in the correct position but being visualised in the correct place
    • May require further work
  • Created a new environment to test the OBB OBB collision in isolation
    • The first cross product axis to test is returning (0,0,0)
      • This means the penetration is 0
    • Upon further testing the marked axes are problem ones when the boxes have no rotations
    • When the boxes have rotaions the tested axes with progressively smaller penetrations (White lines) and final minimum penentration axis (Red line) are correct
    • Added an if statement that blocks the collision detection along an axis that had a magnitude of 0, this means a vector of (0,0,0)
      • Additionally by multiplying the axis penetration by -1 we dont end up with the maximum axis of penetration as -8 is less than -1. This was causing an error ir the minimum axis.
        • This menat that when teh collision resolution happened the two objects moved closer together.
          • To combat this when the penetration is being set we mutiply again by -1

07/08/2017 – OBB vs OBB Revisited

  • Created a tolerance variable for the cube collision to compare floating point values
  • In order to find the collision point
    • Project each corner ono the collision normal
    • then find the corners which are equal or very close to equal to the minimum and add them to a list of As collision points
    • find the points that correspond to the maximum of b and add them to a list of collisionpoints for b
    • depending on the number of points in each list will determine the type of collision
      • 1v1 – corner to corner
      • 1v2 – corner to edge
      • 1v4 – corner to face
      • 2v4 – edge to face
      • 4v4 – face to face
    • Currently returns 6 points for one cube and shows that the corners are not rotated as the object is
  • Added the function RotateCorners() to the OBB class
    • Works as expected
      • blue circles represent the corners of the obb

06/08/2017 – OBB vs Sphere collision resolution and OBB vs OBB

  • Resolved the issue of spheres OBB collision not resolving correctly the further from the centre of the OBB the collision was
    • Made the inertia tensore (0,0,0) for static objects
      • As static objects do no rotate
  • Updated the test environment to accomodate all types of collision
    • Sphere to sphere including resting
    • Cube to sphere including resting
    • Cube to cube
    • Does not include place for testing resting collisions between cubes
  • Rewrote the OBB vs OBB collision detection
    • Used the box’s position + its corners rather than just the corner’s position