Re: [Algorithms] Kinematic Collision
Brought to you by:
vexxed72
|
From: <Pau...@sc...> - 2009-09-02 08:22:36
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi Johan, > Step 1: > If our current position is our target position we can end, otherwise > do a capsulesweep from our current position to our target position + a > small bias, if no collision is reported we can end otherwise continue to > step 2 This biasing is part of your problem, instead of biasing you need to do something similar yet different: When doing your swept shape-cast, you need an inner-hull shape of slighter smaller radius than the outer hull. Then, when you get a TOI intersection (which would obviously embed your outer hull in the ground, and the inner hull just touching), you can 'move back' the whole shape so that the outer hull is just touching. This means that next frame you won't find yourself initially embedded in the ground. Ideally, you wouldn't need to move the shape back and you'd have some kind of method for finding the TOI which puts your shape some known distance from the ground (i.e. the distance from the outer hull to the inner), but this routine is more expensive than a straight intersection test. > Step 3: > Find the vector from the new position and the target location and > retrieve the reflection/tangent components. Set new target position to > the new current position and add both components scaled by a > bounce/friction value [0, 1] to it.. > > * NormalMotion = NormalComponent * Bounce > * TangentMotion = TangentComponent * Friction > * NewTargetPosition = NewPosition + NormalMotion + TangentMotion Here, ideally, you'd give your character a velocity vector and then you can project his velocity into the plane of the normal of the contact point (and subtract friction in the tangential velocity direction, as you mentioned). As others have said you could make it a rigid body, but i don't think you need to go that far for just a character capsule. 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: US-ASCII wsBVAwUBSp4rN3ajGqjtoMHxAQiUHgf+OXbrlifgpUTqi57rWlkY7EZFuN25BQv6 WznoeV8qB/araugRn1rXSJH5nU0VDR+MtbyxvBPWks9Ekx9RUcLJmaM++pYEeh4E MbaVsyITsbS97kMhQURjZwC2MdOaMAFSi93PEqrccZ1kH2IdhRFxTA8Dmke+DawN BTcgS85LUCmHom15W9pI6bpSrzEEZARZ9THaOgqJfNFP2ha9Eraac2bt4E9y/xpm 0NPOT8rMdsGCaRVicMK7Pc4KnaxwFih0byDL5K9n2VVXrjCp2WGKEuDQ9xuHe91H OAE9i+Ikc+uoO7k87AfUIZzKcyzemNYhqwU6/g5vrQeE/VthSTbluw== =MATM -----END PGP SIGNATURE----- |