Wrapper that hides away game/physics maths
I was wondering if there was any wrappers that hide away the math of game
programming. For example I don't care about terms like normalise - I'd
rather just get information I as a game programmer need.
// too math-oriented
Vector2 dir = a.position - b.position;
dir.Normalise();
// much better
DirectionVector2 dir = DirectionVector2.AToB(a.position, b.position);
or even
// true if ball has gone off-screen
// 'dot', 'normal', ugh...
if (Vector2.Dot(WallNormal, WallToBallDir) < 0)
// true if ball has gone off-screen
if (DirectionVector2.GetAngle(WallFacingDir, WallToBallDir) == Angles.Obtuse)
or even even
// some stuff
Matrix world = translation * rotation * scale * 100 other things.
Vector2 rotation = new Vector2(world.m23, world.m33, world.m44);
// made easier
Transform objWorld = new Transform(translateVector, rotVector, scaleVector);
Vector2 rotation = objWorld.rotation;
These are just some off the top of my head. I feel like all of the math
functions ('atan2', 'cos', etc) could just be simplified to getAngle, or
getLength etc. Anyone else agree?
I know I could write this wrapper myself, but I was wondering if
potentially anyone else had started one already for DirectX/XNA.
No comments:
Post a Comment