Jump to content

  • Log In with Google      Sign In   
  • Create Account

wildbunny

Member Since 22 Jan 2011
Offline Last Active Jan 19 2013 06:39 AM

#4795588 Advice about character controller implementation

Posted by wildbunny on 07 April 2011 - 12:20 PM

Hello, I plan to implement character controller for my physics engine. I seek advice from you, what it does, what are the common features. And what to do when, say the character is laying on the floor (what to do with the bounding volume?)


IMO the biggest decision you have to make when thinking about designing a character controller is whether you make you characters actual rigid bodies or not. Whether you can do this will depend on the game type - in LBP, sackboy was a rigid body which wasn't allowed to rotate (inv inertia tensor of zero).

Having the character be a real rigid body rather than a proxy has advantages and disadvantages. It was great in LBP because sackboy has a lot of very close interaction with his environment; he pushes on things, pulls them and gets squashed by them - to facilitate this sackboy actually had his own character constraint which allowed him to be an integral part of the constraint solver :)

Cheers, Paul.


#4795426 Circle vs line segment swept test

Posted by wildbunny on 07 April 2011 - 02:58 AM

raigan, yeah, I thought about that solution and I wonder how to check circle-point swept test. The best thing I can do - is trace rays from end points same as circle velocity but in opposite direction. But I think there better approaches. No, line is stationary.


Let me think.... so to clarify you have a static line segment and you want to detect collision against a moving circle? Can you give us background on the physics scenario you're trying to solve?

Ok, so i think the minkowski difference of a line segment and a circle = capsule, so if the circle's moving, that translates into a raycast against a capsule :)

So, take your line segment, turn it into a capsule by expanding it by the radius of your circle, then raycast against this from the origin of the circle to origin+velocity of circle and the TOI is the one you're after :)

Cheers, Paul.


#4795151 Physics engines for dummies

Posted by wildbunny on 06 April 2011 - 12:41 PM

Hi guys,

I've just written an article about the maths and software engineering behind physics engines in games. Its my hope that, if at the beginning of the article you are comfortable implementing the physics behind Pong, then by the end of the article you will be happy adding your own custom constraints to your physics engine!

http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/

Hope you guys enjoy it :)

Cheers, Paul.


#4790029 Friction impulse. Need formula.

Posted by wildbunny on 24 March 2011 - 11:38 AM

Just take the contact point velocity, V and normal N, form the tangential velocity

T = V - V.N*N

Then create an impulse to remove some portion of this velocity in the same way you did to remove the normal velocity :)

Cheers, Paul.


#4781716 collision issue for 2D rotating objects

Posted by wildbunny on 04 March 2011 - 05:47 AM

In 2d there are two cases to deal with:

vertex vs face
face vs vertex

Either SAT or Minkowski Difference methods can help here....

Cheers, Paul.


#4781351 Enviroment Collision

Posted by wildbunny on 03 March 2011 - 05:26 AM

You are almost certainly running in to the horrible problem of colliding with 'internal edges' of your ground mesh.

Because even a slight penetration can produce a case where your collision normal is now (at least slightly) opposing your direction of travel.


groundInternalEdges.png


Consider this diagram, representing a ground mesh in 2d (blue, with blue vertices) and a colliding sphere which is slightly penetrating. There are two collision points - green and red. The green collision point is valid and perfectly fine, the red collision point (and resulting normal) are from an internal edge, and this is what causes you character to jump or get stuck in extreme cases...

You can see that the red normal is opposing the direction of travel (if character was moving left).

This is a pretty tough problem to solve in general, the best way to do it, is to treat the ground mesh as a special case, and ignore collisions with internal edges. Now the question then becomes one of how you can correctly identify an internal edge - its not totally easy and subject to heuristics unfortunately :)

Hope that helps,

Cheers, Paul.




PARTNERS