Skip to content
 http://www.randygaul.net/2014/05/22/derivingobbtoobbintersectionsat/
 http://box2d.org/
 http://xboxforums.create.msdn.com/forums/t/2642.aspx
 http://slideplayer.com/slide/7468795/
 Added some flow control based on the number of points in each of AsCollisionPoints and BsCollisionPoints so that i can give an accurate representation of thecollision 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 (precollision 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
 1v2 – corner to edge
 Fail – uses corners on the wrong side of the shape
 1v4 – corner to face
 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
 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
 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
 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
 Reworked the Update collisoin function to update the corners with rotational velocity instead of orientation
 However added an additional loop after the UpdateCollisionVolume function call to update the corners for each box with the orientation
 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
 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
 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