Re: [Algorithms] Kinematic Collision
Brought to you by:
vexxed72
|
From: <Pau...@sc...> - 2009-09-03 08:24:42
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 > ...but you are talking about a physics engine here. I was only talking about > an old-style "character controller", a.k.a. collide-and-slide, à la Paul > Nettle / Quake / etc. Typical "modern" physics engines certainly need > penetration vectors. Character controllers, not necessarily - you can go a > long way without. Ahhh, yes, you might get away with a lot more with a simple character controller. As long as nothing is allowed to 'push' the character into the ground or weigh it down, that is! :) > Can you give more details here? I think you can find "a" penetration > vector -in the direction of motion-, yes, but it is vastly different from > "the" penetration vector, a.k.a. MTD, which can be in a completely different > direction. I don't think I know a way to compute both with the same piece of > code. Ok, so if we're talking about a generic convex linear cast here, we can do the ray intersection (where the ray is the delta velocity vector of the two objects) against the minkowski difference of the two shapes (which is now static) iteratively as long as we have a utility function that will give us the closest point on the MD and the normal at that point. This information is actually already giving us penetration info if we start initially penetrated. Basically, you iterate (starting with the ray start position) asking the system for the closest point on the MD to the current ray pos and the normal. Then you intersect the ray with that normal and carry on. It usually converges very quickly, especially for poly objects and you get the TOI and the penetration info in one, should there be a TOI of 0. You can even use this to handle objects that rotate as well with slight modification of the algorithm. This is gino van den bergen's algorithm btw, where he uses GJK for the utility function - but we don't have to use GJK, we can use any custom written algorithm. So for two spheres, you just need closest point on sphere to given point, which is easy to write, or for triangle vs sphere you just need a distance to triangle function... Cheers, Paul. ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify pos...@sc... This footnote also confirms that this email message has been checked for all known viruses. Sony Computer Entertainment Europe Limited Registered Office: 10 Great Marlborough Street, London W1F 7LP, United Kingdom Registered in England: 3277793 ********************************************************************** P Please consider the environment before printing this e-mail -----BEGIN PGP SIGNATURE----- Version: PGP Universal 2.9.1 (Build 287) Charset: ISO-8859-1 wsBVAwUBSp99P3ajGqjtoMHxAQiBKQf8Ch+o3+FpA1QqT0KJBDVDQ3g26+UT6EvP lQO4KwCHlVFDKYMpxnP76W3JFNixxpfTo6vBWyuupau1ps5+Nhq+LJWUwIQoSI9l A4BFDekzcssFnR78MEffFyr6aLa/II0RclIcVl2tDCou6wLpLRSd6ojk29h6dW59 RhX5kIdTYPEZlqLtlh2bCGKxPMqT5q5l7JjPHdIesaEGws3pfSMtWFRIK4XDAm1q CUjmk6PcuNa+GZqzZ4JuMECW8xTGAZ4LITjKd4+aC/l4LP8Ewr2KGr47IHk6BLI0 dIrPmxB6zblEwK6U1spUsruPVJpPvgh3KhOZOg+6QfPVkrAudQ3PPQ== =PUTi -----END PGP SIGNATURE----- |