# Collision Resolving

This topic is 2529 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Silly me posted a topic in graphics programming by accident.
Okay so I'm working on a game in C# XNA and I'm having a hard time wrapping my head around a good collision resolve.

So here is the code I have so far for my AABB's
This will be run after collision has been confirmed
 Vector3 Vec1, Vec2; //Intersection of the AABB's Vector3 VecMin1, VecMax1, VecMin2, VecMax2; // Minimum of Box1, Maximum of Box 1, Minimum of Box 2, Maximum of Box 2 Respectively bool X, Y, Z; //if X Y or Z are false then they will not be treated as moving VecMin1 = Min + Position; VecMax1 = Max + Position; VecMin2 = Box.Min + Box.Position; VecMax2 = Box.Max + Box.Position; X = Y = Z = true; if (Velocity.X > 0) { Vec1.X = Math.Max(VecMin2.X, VecMin1.X); Vec2.X = VecMax1.X; } else if (Velocity.X < 0) { Vec1.X = Math.Min(VecMax2.X, VecMax1.X); Vec2.X = VecMin1.X; } else { X = false; } if (Velocity.Y > 0) { Vec1.Y = Math.Max(VecMin2.Y, VecMin1.Y); Vec2.Y = VecMax1.Y; } else if (Velocity.Y < 0) { Vec1.Y = Math.Min(VecMax2.Y, VecMax1.Y); Vec2.Y = VecMin1.Y; } else { Y = false; } if (Velocity.Z > 0) { Vec1.Z = Math.Max(VecMin2.Z, VecMin1.Z); Vec2.Z = VecMax1.Z; } else if (Velocity.Z < 0) { Vec1.X = Math.Min(VecMax2.Z, VecMax1.Z); Vec2.Z = VecMin1.Z; } else { Z = false; }

My minimum need for collisions as well as the obvious are working slopes and wall sliding.
My intention for collisions are moving platforms, curves, slopes, actual physics like movement (EG moving so fast up a slope result in take off)
I've come up with theories but I can't settle on anything.
The world is made out of blocks 3 x 3 x 3 blocks. some are slope shaped (so their not quite blocks but you get the idea)
I want the resolve to work on a per collision basis. The only way I thought would work, I realized would overkill when colliding with multiple blocks.

Any and all help is appreciated,
Bombshell

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633295
• Total Posts
3011245
• ### Who's Online (See full list)

There are no registered users currently online

×