if (Vector3.Dot(t.normal, bdir) > 0)
February 9th, 2012 by bug

In spite of XNA’s attempt to build a vector library that even orangutans could use (in turn in spite of the irredeemable clumsiness of .NET’s type system), I find myself doing high school trigonometry by hand more often than seems necessary. On the other hand, if I didn’t stop to think that cos(±π/2) = 0, this condition check would have been much more inefficient:

if (Math.Acos(Vector3.Dot(t.normal, bdir)) < Math.PI / 2)

This is also what a built-in Vector3.AngleBetween() function would have done, if there was one. The fewer trig calls the better…

Anyway, this is all part of a new collision routine specifically for platforms, designed to support one-way, bouncy, and moving platforms (in any combination).

The rest of my time during the past week was spent practicing video game cosmetology: removing the most unsightly bugs and temporary assets, touching up colors, and even adding a nifty new, fluid “chase” camera, which drew much attention during our industry demo. Sometimes the little things really count!


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

»  Substance:WordPress   »  Style:Ahren Ahimsa