mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	Fix RayShape collision when used with a KinematicBody (Bullet Physics)
- Added code handling non-compound collision to recover_from_penetration_ray() which is now needed due to the optimization avoiding the use of compound collisions when only a single collision shape is used. - Removed arbitrary margin applied in the collision algorithm of RayShapes which causes jittered movement. For lack of a better replacement and for lack of any explanation on why it has been introduced, it's now using the shape's margin property instead which is small enough to not show visible jitter. - Tried to get rid of inconsistent uses of the collision margin. - Removed hack from GodotDeepPenetrationContactResultCallback::addContactPoint for RayShape collision as it's no longer needed as the collision algorithm of RayShapes correctly calculates the contact normal for a while now. Fixes #25227.
This commit is contained in:
		
							parent
							
								
									4fd579b271
								
							
						
					
					
						commit
						f7511511b1
					
				
					 5 changed files with 32 additions and 29 deletions
				
			
		|  | @ -35,8 +35,6 @@ | |||
| 
 | ||||
| #include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h> | ||||
| 
 | ||||
| #define RAY_STABILITY_MARGIN 0.1 | ||||
| 
 | ||||
| /**
 | ||||
| 	@author AndreaCatania | ||||
| */ | ||||
|  | @ -102,8 +100,8 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo | |||
| 
 | ||||
| 		btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1)); | ||||
| 
 | ||||
| 		if (depth >= -RAY_STABILITY_MARGIN) | ||||
| 			depth = 0; | ||||
| 		if (depth >= -ray_shape->getMargin()) | ||||
| 			depth *= 0.5; | ||||
| 
 | ||||
| 		if (ray_shape->getSlipsOnSlope()) | ||||
| 			resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Daniel Rakos
						Daniel Rakos