Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Apr 2012
Offline Last Active Sep 09 2013 02:33 PM

Posts I've Made

In Topic: Rotate A Quad Along Axis To Face Camera

01 February 2013 - 01:49 PM

Your method seems way simpler :)

In Topic: Rotate A Quad Along Axis To Face Camera

01 February 2013 - 01:46 PM

Thanks Rob.


I found a solution within the library, after learning some basic math.


 Orientation3D.SetUpDirection(ref cparticle.Orientation, Vector3.Cross(cparticle.Velocity, CameraPosition - cparticle.Position));


I'll try to see if I can use your method to edit the vertices directly, but it looks a little like the function it calls is doing as you suggest anyway.


        public static Quaternion GetRotationTo(Vector3 CurrentDirection, Vector3 DesiredDirection, Vector3 sFallbackAxis)
            Quaternion quaternion = new Quaternion();
            Vector3 vector = CurrentDirection;
            Vector3 vector2 = DesiredDirection;
            float num = Vector3.Dot(vector, vector2);
            if (num >= 1f)
                return Quaternion.Identity;
            if (num <= -0.999999f)
                if (sFallbackAxis != Vector3.Zero)
                    return Quaternion.CreateFromAxisAngle(sFallbackAxis, 3.141593f);
                Vector3 axis = Vector3.Cross(Vector3.UnitX, vector);
                if (axis.LengthSquared() < 0.999998f)
                    axis = Vector3.Cross(Vector3.UnitY, vector);
                return Quaternion.CreateFromAxisAngle(axis, 3.141593f);
            Vector3 vector4 = Vector3.Cross(vector, vector2);
            double num2 = Math.Sqrt((double) ((1f + num) * 2f));
            double num3 = 1.0 / num2;
            quaternion.X = (float) (vector4.X * num3);
            quaternion.Y = (float) (vector4.Y * num3);
            quaternion.Z = (float) (vector4.Z * num3);
            quaternion.W = (float) (num2 * 0.5);
            return quaternion;

In Topic: XNA 4.0 - shimmering shadow maps

30 June 2012 - 02:58 PM

I would very much like to thank you for the explanation and code. I had shadows that would shimmer whenever I rotated or moved. Now they are rock solid. The difference is very satisfying :)

If you are interested here's a playlist that details my shadows development:


Or have a look at this video:

In Topic: Programmer already, just new to gaming

25 April 2012 - 02:06 PM

I have been programming professionally for 25 years, usually large corporations, COBOL, C, VB, SQL and so on. I started dabbling with XNA and C#. The code is very easy to understand. It's techniques that are real key. I would wade through the example XNA programs on the APPHUB website. They are very informative and complete.

In Topic: I want to align my bullet hole decal with the surface hit

25 April 2012 - 01:56 PM

Here's a video of the problem fixed!

I ditched the idea of using a trianglelist based particle system. Instead I use a quad model circular array. I can manipulate the matrix up vector using the normal of the surface hit.

Thanks for looking.

BTW: I think I should have posted this in the XNA section, sorry about that, I didn't realise till after posting.