Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Feb 2011
Offline Last Active Mar 27 2014 12:55 PM

Posts I've Made

In Topic: [Solved]Deferred Rendering - Point lights only half shaded?

10 December 2013 - 09:09 AM

Scrath that, figured it out.  I was mapping my normals incorrectly and got it fixed now!

In Topic: DX11 - Disabling depth testing?

09 December 2013 - 07:22 PM

All of these replies have been very helpful and solved my problem.  Thanks everyone for the help!

In Topic: "Stringify" virtual keys

23 June 2013 - 11:04 AM

You can try creating a table that directly maps the virtual key to a string table. Since the virtual key is just an integer value, create a string table with the string values for each virtual key.


Create one string table for each language then group that by keyboard layout.

Is there a more programmatic way to do it?  Having to have separate lookup tables for each possible layout for each possible language seems like a nightmare that I'm hoping to avoid.



If you're using Windows, MapVirtualKey()/MapVirtualKeyEx() may be of use. Not sure if there's a better way.


That's the method I'm currently using to convert the scan code into the virtual key code.  Now I just need a way to display that virtual key as a string

In Topic: Collision resolution between multiple AABB objects

04 February 2013 - 12:27 PM

In the first loop you clear the velocity change when you first encounter a sprite, but it may have already been in a collision by that point.

For example if the first rectangle hits the second, the second will receive a velocity change, which will be cleared before it is applied.

You may also need to run through the whole list multiple times to resolve all intersections.

Good god, I feel ridiculously foolish for missing that.  I'll test that out later today and see if it fixes it, but it would explain a lot.  Sometimes its the simple things I guess.


I had tried running through the process multiple times and that lessened the problem.  Is this an actual approach that some physics engines take?  It seems so inefficient.

In Topic: Collision resolution between multiple AABB objects

04 February 2013 - 11:38 AM

if(aPhysicsComponent->m_mass > 0 && bPhysicsComponent->m_mass > 0)
Vector2D impulse = hitNormalA;
float restitutionCoefficient = -0.5f;

impulse *= (-(1.0f + restitutionCoefficient));
impulse /= (1/spriteAMass + 1/spriteBMass);

aPhysicsComponent->m_velocityChangesToApply += (hitNormalA);
bPhysicsComponent->m_velocityChangesToApply += (hitNormalB);



Would this work?


    aPhysicsComponent->m_velocityChangesToApply += (hitNormalA) * impulse / spriteAMass;
    bPhysicsComponent->m_velocityChangesToApply += (hitNormalB* impulse / spriteBMass;

Well both hitNormalA/B and impulse are both vectors.  Ideally impulse should be some force and direction applied on collision to both objects for a bounce effect, but I'm not even using that right now.  currently I'm just trying to move the objects apart by the penetration amount (hitNormalA = hitNormal * penetrationDepth) to separate them.


What's happening is that my method breaks when any one object is colliding with more than one other object.  I think that the middle object is being acted upon by both sides and can't resolve either collision as its always blocked by one of the other two objects.


So that makes me think that it may not necessarily be a problem with my collision resolution code but is instead more of a fundamental, conceptual problem with how I'm conducting my collision tests?