@onerjs/core 8.32.0 → 8.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Audio/Interfaces/ISoundOptions.d.ts +1 -1
- package/Audio/Interfaces/ISoundOptions.js.map +1 -1
- package/Audio/audioEngine.d.ts +3 -4
- package/Audio/audioEngine.js +9 -6
- package/Audio/audioEngine.js.map +1 -1
- package/Audio/sound.d.ts +33 -54
- package/Audio/sound.js +450 -718
- package/Audio/sound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.js +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSound.js +2 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundSource.d.ts +11 -3
- package/AudioV2/abstractAudio/abstractSoundSource.js +37 -1
- package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
- package/AudioV2/abstractAudio/audioBus.d.ts +8 -3
- package/AudioV2/abstractAudio/audioBus.js +24 -1
- package/AudioV2/abstractAudio/audioBus.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +1 -1
- package/AudioV2/abstractAudio/staticSound.js +2 -2
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
- package/AudioV2/abstractAudio/streamingSound.js +2 -2
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +1 -1
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +3 -0
- package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +1 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +1 -0
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +12 -2
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +2 -0
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +25 -0
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +2 -2
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +3 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +14 -17
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +1 -0
- package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js +1 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -1
- package/AudioV2/webAudio/webAudioBus.d.ts +2 -7
- package/AudioV2/webAudio/webAudioBus.js +4 -24
- package/AudioV2/webAudio/webAudioBus.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.js +1 -0
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -7
- package/AudioV2/webAudio/webAudioSoundSource.js +3 -24
- package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +3 -7
- package/AudioV2/webAudio/webAudioStaticSound.js +13 -26
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -7
- package/AudioV2/webAudio/webAudioStreamingSound.js +6 -23
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/arcRotateCamera.js +4 -5
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Compute/computeEffect.js +5 -1
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.d.ts +4 -0
- package/Compute/computeShader.js +9 -3
- package/Compute/computeShader.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/abstractEngine.d.ts +2 -2
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinEngine.js +1 -1
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +8 -9
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.d.ts +74 -0
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js +179 -0
- package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/index.d.ts +2 -0
- package/FrameGraph/Node/Blocks/index.js +2 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.d.ts +43 -0
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.js +93 -0
- package/FrameGraph/Node/Blocks/lightingVolumeBlock.js.map +1 -0
- package/FrameGraph/Passes/renderPass.js +2 -2
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +2 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js +6 -0
- package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +1 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.js +3 -0
- package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +1 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js +3 -0
- package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js +3 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/cullObjectsTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js +3 -0
- package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/executeTask.d.ts +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
- package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +32 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +63 -0
- package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/convolutionTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/filterTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/filterTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/fxaaTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/grainTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/grainTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +2 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js +6 -0
- package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +3 -2
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/sharpenTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js +3 -0
- package/FrameGraph/Tasks/PostProcesses/tonemapTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +31 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +60 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +93 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +183 -0
- package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +4 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +1 -0
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +4 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +3 -0
- package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js +21 -4
- package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +1 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -0
- package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
- package/FrameGraph/frameGraphRenderContext.js +14 -5
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +5 -0
- package/FrameGraph/frameGraphTask.js +11 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/index.d.ts +2 -0
- package/FrameGraph/index.js +2 -0
- package/FrameGraph/index.js.map +1 -1
- package/Lights/lightingVolume.d.ts +12 -6
- package/Lights/lightingVolume.js +218 -108
- package/Lights/lightingVolume.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +2 -2
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +2 -1
- package/Meshes/geometry.js +6 -2
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -1
- package/Meshes/mesh.js +4 -3
- package/Meshes/mesh.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +9 -1
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +8 -0
- package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
- package/Particles/Node/Blocks/Update/updateNoiseBlock.d.ts +39 -0
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js +102 -0
- package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -0
- package/Particles/Node/Blocks/index.d.ts +1 -0
- package/Particles/Node/Blocks/index.js +1 -0
- package/Particles/Node/Blocks/index.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +9 -5
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +31 -13
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.js +39 -21
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Particles/particle.d.ts +2 -2
- package/Particles/particle.js +4 -2
- package/Particles/particle.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +1 -1
- package/Particles/thinParticleSystem.function.js +2 -2
- package/Particles/thinParticleSystem.function.js.map +1 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Physics/v2/characterController.d.ts +42 -2
- package/Physics/v2/characterController.js +140 -46
- package/Physics/v2/characterController.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +2 -2
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/volumetricLightingBlendVolume.fragment.d.ts +5 -0
- package/Shaders/volumetricLightingBlendVolume.fragment.js +21 -0
- package/Shaders/volumetricLightingBlendVolume.fragment.js.map +1 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.d.ts +7 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.js +25 -0
- package/Shaders/volumetricLightingRenderVolume.fragment.js.map +1 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.d.ts +9 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.js +18 -0
- package/Shaders/volumetricLightingRenderVolume.vertex.js.map +1 -0
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/lightingVolume.compute.js +10 -4
- package/ShadersWGSL/lightingVolume.compute.js.map +1 -1
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.d.ts +5 -0
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js +22 -0
- package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js.map +1 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.d.ts +7 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js +27 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js.map +1 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.d.ts +7 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js +17 -0
- package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js.map +1 -0
- package/States/IStencilState.d.ts +48 -2
- package/States/IStencilState.js.map +1 -1
- package/States/alphaCullingState.d.ts +1 -0
- package/States/alphaCullingState.js +3 -0
- package/States/alphaCullingState.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"characterController.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/characterController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIlF,OAAO,EAAE,mBAAmB,EAAqB,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAoBlD;;GAEG;AACH,MAAM,CAAN,IAAkB,uBAIjB;AAJD,WAAkB,uBAAuB;IACrC,mFAAW,CAAA;IACX,2EAAO,CAAA;IACP,+EAAS,CAAA;AACb,CAAC,EAJiB,uBAAuB,KAAvB,uBAAuB,QAIxC;AAsED,IAAW,kCAIV;AAJD,WAA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BAAsB,CAAC,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxI,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import { Vector3, Quaternion, Matrix, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { DeepImmutableObject } from \"../../types\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\nimport { PhysicsShapeCapsule, type PhysicsShape } from \"./physicsShape\";\r\nimport { PhysicsMotionType } from \"./IPhysicsEnginePlugin\";\r\nimport type { HavokPlugin } from \"./Plugins/havokPlugin\";\r\nimport { BuildArray } from \"core/Misc/arrayTools\";\r\n\r\n/**\r\n * Shape properties for the character controller\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface CharacterShapeOptions {\r\n /**\r\n * optional shape used for collision detection\r\n */\r\n shape?: PhysicsShape;\r\n /**\r\n * capsule height for the capsule shape if no shape is provided\r\n */\r\n capsuleHeight?: number;\r\n /**\r\n * capsule radius for the capsule shape if no shape is provided\r\n */\r\n capsuleRadius?: number;\r\n}\r\n/**\r\n * State of the character on the surface\r\n */\r\nexport const enum CharacterSupportedState {\r\n UNSUPPORTED,\r\n SLIDING,\r\n SUPPORTED,\r\n}\r\n\r\n/**\r\n * Surface information computed by checkSupport method\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface CharacterSurfaceInfo {\r\n /**\r\n * Indicates whether the surface is dynamic.\r\n * A dynamic surface is one that can change its properties over time,\r\n * such as moving platforms or surfaces that can be affected by external forces.\r\n * surfaceInfo.supportedState is always CharacterSupportedState.SUPPORTED when isSurfaceDynamic is true.\r\n */\r\n isSurfaceDynamic: boolean;\r\n /**\r\n * The supported state of the character on the surface.\r\n */\r\n supportedState: CharacterSupportedState;\r\n /**\r\n * The average normal vector of the surface.\r\n * This vector is perpendicular to the surface and points outwards.\r\n */\r\n averageSurfaceNormal: Vector3;\r\n /**\r\n * The average velocity of the surface.\r\n * This vector represents the speed and direction in which the surface is moving.\r\n */\r\n averageSurfaceVelocity: Vector3;\r\n /**\r\n * The average angular velocity of the surface.\r\n */\r\n averageAngularSurfaceVelocity: Vector3;\r\n}\r\n\r\ninterface IContact {\r\n /** @internal */\r\n position: Vector3;\r\n /** @internal */\r\n normal: Vector3;\r\n /** @internal */\r\n distance: number;\r\n /** @internal */\r\n fraction: number;\r\n /** @internal */\r\n bodyB: { body: PhysicsBody; index: number };\r\n /** @internal */\r\n allowedPenetration: number;\r\n}\r\n\r\ninterface ISurfaceConstraintInfo {\r\n /** @internal */\r\n planeNormal: Vector3;\r\n /** @internal */\r\n planeDistance: number;\r\n /** @internal */\r\n velocity: Vector3;\r\n /** @internal */\r\n angularVelocity: Vector3;\r\n /** @internal */\r\n staticFriction: number;\r\n /** @internal */\r\n extraUpStaticFriction: number;\r\n /** @internal */\r\n extraDownStaticFriction: number;\r\n /** @internal */\r\n dynamicFriction: number;\r\n /** @internal */\r\n priority: number;\r\n}\r\n\r\nconst enum SurfaceConstraintInteractionStatus {\r\n OK,\r\n FAILURE_3D,\r\n FAILURE_2D,\r\n}\r\ninterface ISurfaceConstraintInteraction {\r\n /** @internal */\r\n touched: boolean;\r\n /** @internal */\r\n stopped: boolean;\r\n /** @internal */\r\n surfaceTime: number;\r\n /** @internal */\r\n penaltyDistance: number;\r\n /** @internal */\r\n status: SurfaceConstraintInteractionStatus;\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverOutput {\r\n /** @internal */\r\n public position: Vector3;\r\n /** @internal */\r\n public velocity: Vector3;\r\n /** @internal */\r\n public deltaTime: number;\r\n /** @internal */\r\n public planeInteractions: ISurfaceConstraintInteraction[];\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverActivePlanes {\r\n /** @internal */\r\n public index: number;\r\n /** @internal */\r\n public constraint: ISurfaceConstraintInfo;\r\n /** @internal */\r\n public interaction: ISurfaceConstraintInteraction;\r\n\r\n /** @internal */\r\n public copyFrom(other: SimplexSolverActivePlanes) {\r\n this.index = other.index;\r\n this.constraint = other.constraint;\r\n this.interaction = other.interaction;\r\n }\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverInfo {\r\n /** @internal */\r\n public supportPlanes: Array<SimplexSolverActivePlanes> = new Array<SimplexSolverActivePlanes>(4);\r\n /** @internal */\r\n public numSupportPlanes: number = 0;\r\n /** @internal */\r\n public currentTime: number = 0;\r\n /** @internal */\r\n public inputConstraints: ISurfaceConstraintInfo[];\r\n /** @internal */\r\n public outputInteractions: ISurfaceConstraintInteraction[];\r\n /** @internal */\r\n public getOutput(constraint: ISurfaceConstraintInfo): ISurfaceConstraintInteraction {\r\n return this.outputInteractions[this.inputConstraints.indexOf(constraint)]; //<todo.eoin This is O(1) in C++! Equivalent in TS?\r\n }\r\n}\r\n\r\n/** @internal */\r\nfunction ContactFromCast(hp: HavokPlugin, cp: any /*ContactPoint*/, castPath: Vector3, hitFraction: number, keepDistance: number): IContact {\r\n const bodyMap = (hp as any)._bodies;\r\n\r\n const normal = Vector3.FromArray(cp[4]);\r\n const dist = -hitFraction * castPath.dot(normal);\r\n return {\r\n position: Vector3.FromArray(cp[3]),\r\n normal: normal,\r\n distance: dist,\r\n fraction: hitFraction,\r\n bodyB: bodyMap.get(cp[0][0])!,\r\n allowedPenetration: Math.min(Math.max(keepDistance - dist, 0.0), keepDistance),\r\n };\r\n}\r\n\r\n/**\r\n * Character controller using physics\r\n */\r\nexport class PhysicsCharacterController {\r\n private _position: Vector3;\r\n private _orientation: Quaternion = Quaternion.Identity();\r\n private _velocity: Vector3;\r\n private _lastVelocity: Vector3;\r\n private _shape: PhysicsShape;\r\n private _ownShape: boolean;\r\n private _manifold: IContact[] = [];\r\n private _lastDisplacement: Vector3;\r\n private _contactAngleSensitivity = 10.0;\r\n private _lastInvDeltaTime: number;\r\n private _scene: Scene;\r\n private _tmpMatrix = new Matrix();\r\n private _tmpVecs: Vector3[] = BuildArray(31, Vector3.Zero);\r\n\r\n /**\r\n * minimum distance to make contact\r\n * default 0.05\r\n */\r\n public keepDistance: number = 0.05;\r\n /**\r\n * maximum distance to keep contact\r\n * default 0.1\r\n */\r\n public keepContactTolerance: number = 0.1;\r\n /**\r\n * maximum number of raycast per integration starp\r\n * default 10\r\n */\r\n public maxCastIterations: number = 10;\r\n /**\r\n * speed when recovery from penetration\r\n * default 1.0\r\n */\r\n public penetrationRecoverySpeed = 1.0;\r\n /**\r\n * friction with static surfaces\r\n * default 0\r\n */\r\n public staticFriction = 0;\r\n /**\r\n * friction with dynamic surfaces\r\n * default 1\r\n */\r\n public dynamicFriction = 1;\r\n /**\r\n * cosine value of slope angle that can be climbed\r\n * computed as `Math.cos(Math.PI * (angleInDegree / 180.0));`\r\n * default 0.5 (value for a 60deg angle)\r\n */\r\n public maxSlopeCosine = 0.5;\r\n /**\r\n * character maximum speed\r\n * default 10\r\n */\r\n public maxCharacterSpeedForSolver = 10.0;\r\n /**\r\n * up vector\r\n */\r\n public up = new Vector3(0, 1, 0);\r\n /**\r\n * Strength when pushing other bodies\r\n * default 1e38\r\n */\r\n public characterStrength = 1e38;\r\n\r\n /**\r\n * Acceleration factor. A value of 1 means reaching max velocity immediately\r\n */\r\n public acceleration = 0.05;\r\n\r\n /**\r\n * maximum acceleration in world space coordinate\r\n */\r\n public maxAcceleration = 50;\r\n\r\n /**\r\n * character mass\r\n * default 0\r\n */\r\n public characterMass = 0;\r\n private _startCollector;\r\n private _castCollector;\r\n\r\n /**\r\n * instanciate a new characterController\r\n * @param position Initial position\r\n * @param characterShapeOptions character physics shape options\r\n * @param scene Scene\r\n */\r\n public constructor(position: Vector3, characterShapeOptions: CharacterShapeOptions, scene: Scene) {\r\n this._position = position.clone();\r\n this._velocity = Vector3.Zero();\r\n this._lastVelocity = Vector3.Zero();\r\n const r = characterShapeOptions.capsuleRadius ?? 0.6;\r\n const h = characterShapeOptions.capsuleHeight ?? 1.8;\r\n this._tmpVecs[0].set(0, h * 0.5 - r, 0);\r\n this._tmpVecs[1].set(0, -h * 0.5 + r, 0);\r\n this._ownShape = !characterShapeOptions.shape;\r\n this._shape = characterShapeOptions.shape ?? new PhysicsShapeCapsule(this._tmpVecs[0], this._tmpVecs[1], r, scene);\r\n this._lastInvDeltaTime = 1.0 / 60.0;\r\n this._lastDisplacement = Vector3.Zero();\r\n this._scene = scene;\r\n\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n this._startCollector = hknp.HP_QueryCollector_Create(16)[1];\r\n this._castCollector = hknp.HP_QueryCollector_Create(16)[1];\r\n }\r\n\r\n /**\r\n * Get shape used for collision\r\n */\r\n public get shape() {\r\n return this._shape;\r\n }\r\n\r\n /**\r\n * Set shape used for collision\r\n */\r\n public set shape(value: PhysicsShape) {\r\n if (this._ownShape) {\r\n this._shape.dispose();\r\n }\r\n this._shape = value;\r\n this._ownShape = false;\r\n }\r\n\r\n /**\r\n * Character position\r\n * @returns Character position\r\n */\r\n public getPosition(): Vector3 {\r\n return this._position;\r\n }\r\n\r\n /**\r\n * Teleport character to a new position\r\n * @param position new position\r\n */\r\n public setPosition(position: Vector3) {\r\n this._position.copyFrom(position);\r\n }\r\n\r\n /**\r\n * Character velocity\r\n * @returns Character velocity vector\r\n */\r\n public getVelocity(): Vector3 {\r\n return this._velocity;\r\n }\r\n\r\n /**\r\n * Set velocity vector\r\n * @param velocity vector\r\n */\r\n public setVelocity(velocity: Vector3) {\r\n this._velocity.copyFrom(velocity);\r\n }\r\n\r\n protected _validateManifold() {\r\n const newManifold = [];\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n if (!this._manifold[i].bodyB.body.isDisposed) {\r\n newManifold.push(this._manifold[i]);\r\n }\r\n }\r\n this._manifold = newManifold;\r\n }\r\n\r\n private _getPointVelocityToRef(body: { body: PhysicsBody; index: number }, pointWorld: Vector3, result: Vector3) {\r\n //<todo does this really not exist in body interface?\r\n const comWorld = this._tmpVecs[10];\r\n this._getComWorldToRef(body, comWorld);\r\n const relPos = this._tmpVecs[11];\r\n pointWorld.subtractToRef(comWorld, relPos);\r\n const av = this._tmpVecs[12];\r\n body.body.getAngularVelocityToRef(av, body.index);\r\n const arm = this._tmpVecs[13];\r\n Vector3.CrossToRef(av, relPos, arm);\r\n arm.addToRef(body.body.getLinearVelocity(body.index), result);\r\n }\r\n\r\n protected _compareContacts(contactA: IContact, contactB: IContact): number {\r\n const angSquared = (1.0 - contactA.normal.dot(contactB.normal)) * this._contactAngleSensitivity * this._contactAngleSensitivity;\r\n const planeDistSquared = (contactA.distance - contactB.distance) * (contactA.distance * contactB.distance);\r\n\r\n const p1Vel = this._tmpVecs[7];\r\n this._getPointVelocityToRef(contactA.bodyB, contactA.position, p1Vel);\r\n const p2Vel = this._tmpVecs[8];\r\n this._getPointVelocityToRef(contactB.bodyB, contactB.position, p2Vel);\r\n const velocityDiff = this._tmpVecs[9];\r\n p1Vel.subtractToRef(p2Vel, velocityDiff);\r\n const velocityDiffSquared = velocityDiff.lengthSquared();\r\n\r\n const fitness = angSquared * 10.0 + velocityDiffSquared * 0.1 + planeDistSquared;\r\n return fitness;\r\n }\r\n\r\n protected _findContact(referenceContact: IContact, contactList: IContact[], threshold: number) {\r\n let bestIdx = -1;\r\n let bestFitness = threshold;\r\n for (let i = 0; i < contactList.length; i++) {\r\n const fitness = this._compareContacts(referenceContact, contactList[i]);\r\n if (fitness < bestFitness) {\r\n bestFitness = fitness;\r\n bestIdx = i;\r\n }\r\n }\r\n return bestIdx;\r\n }\r\n\r\n protected _updateManifold(startCollector: any /*HP_CollectorId*/, castCollector: any /*HP_CollectorId*/, castPath: Vector3): number {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n const numProximityHits = hknp.HP_QueryCollector_GetNumHits(startCollector)[1];\r\n if (numProximityHits > 0) {\r\n const newContacts = [];\r\n let minDistance = 1e38;\r\n const bodyMap = (<any>hk)._bodies;\r\n for (let i = 0; i < numProximityHits; i++) {\r\n const [distance, , contactWorld] = hknp.HP_QueryCollector_GetShapeProximityResult(startCollector, i)[1];\r\n minDistance = Math.min(minDistance, distance);\r\n newContacts.push({\r\n position: Vector3.FromArray(contactWorld[3]),\r\n normal: Vector3.FromArray(contactWorld[4]),\r\n distance: distance,\r\n fraction: 0,\r\n bodyB: bodyMap.get(contactWorld[0][0])!,\r\n allowedPenetration: Math.min(Math.max(this.keepDistance - distance, 0.0), this.keepDistance),\r\n });\r\n }\r\n\r\n for (let i = this._manifold.length - 1; i >= 0; i--) {\r\n const currentContact = this._manifold[i];\r\n const bestMatch = this._findContact(currentContact, newContacts, 1.1);\r\n if (bestMatch >= 0) {\r\n const newAllowedPenetration = Math.min(Math.max(this.keepDistance - newContacts[bestMatch].distance, 0.0), currentContact.allowedPenetration);\r\n this._manifold[i] = newContacts[bestMatch];\r\n this._manifold[i].allowedPenetration = newAllowedPenetration;\r\n newContacts.splice(bestMatch, 1);\r\n } else {\r\n this._manifold.splice(i, 1);\r\n }\r\n }\r\n\r\n const closestContactIndex = newContacts.findIndex((c) => c.distance == minDistance);\r\n if (closestContactIndex >= 0) {\r\n const bestMatch = this._findContact(newContacts[closestContactIndex], this._manifold, 0.1);\r\n if (bestMatch >= 0) {\r\n const newAllowedPenetration = Math.min(\r\n Math.max(this.keepDistance - newContacts[closestContactIndex].distance, 0.0),\r\n this._manifold[bestMatch].allowedPenetration\r\n );\r\n this._manifold[bestMatch] = newContacts[closestContactIndex];\r\n this._manifold[bestMatch].allowedPenetration = newAllowedPenetration;\r\n } else {\r\n this._manifold.push(newContacts[closestContactIndex]);\r\n }\r\n }\r\n } else {\r\n // No start hits; clear manifold completely\r\n this._manifold.length = 0;\r\n }\r\n\r\n let numHitBodies = 0; //< == CASTCOLLECTOR_HIT_SINGLE_BODY\r\n // Process shape cast results if any\r\n const numCastHits = hknp.HP_QueryCollector_GetNumHits(castCollector)[1];\r\n if (numCastHits > 0) {\r\n let closestHitBody = null;\r\n for (let i = 0; i < numCastHits; i++) {\r\n const [fraction, , hitWorld] = hknp.HP_QueryCollector_GetShapeCastResult(castCollector, i)[1];\r\n if (closestHitBody == null) {\r\n const contact = ContactFromCast(hk, hitWorld, castPath, fraction, this.keepDistance);\r\n closestHitBody = hitWorld[0][0];\r\n const bestMatch = this._findContact(contact, this._manifold, 0.1);\r\n if (bestMatch == -1) {\r\n this._manifold.push(contact);\r\n }\r\n\r\n if (contact.bodyB.body.getMotionType(contact.bodyB.index) == PhysicsMotionType.STATIC) {\r\n // The closest body is static, so it cannot move away from CC and we don't need to look any further.\r\n break;\r\n }\r\n } else if (closestHitBody._pluginData && hitWorld[0] != closestHitBody._pluginData.hpBodyId) {\r\n numHitBodies++;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Remove from the manifold contacts that are too similar as the simplex does not handle parallel planes\r\n for (let e1 = this._manifold.length - 1; e1 >= 0; e1--) {\r\n let e2 = e1 - 1;\r\n for (; e2 >= 0; e2--) {\r\n const fitness = this._compareContacts(this._manifold[e1], this._manifold[e2]);\r\n if (fitness < 0.1) {\r\n break;\r\n }\r\n }\r\n if (e2 >= 0) {\r\n this._manifold.slice(e1, 1);\r\n }\r\n }\r\n\r\n return numHitBodies;\r\n }\r\n\r\n protected _createSurfaceConstraint(contact: IContact, timeTravelled: number): ISurfaceConstraintInfo {\r\n const constraint = {\r\n //let distance = contact.distance - this.keepDistance;\r\n planeNormal: contact.normal.clone(),\r\n planeDistance: contact.distance,\r\n staticFriction: this.staticFriction,\r\n dynamicFriction: this.dynamicFriction,\r\n extraUpStaticFriction: 0,\r\n extraDownStaticFriction: 0,\r\n velocity: Vector3.Zero(),\r\n angularVelocity: Vector3.Zero(),\r\n priority: 0,\r\n };\r\n\r\n const maxSlopeCosEps = 0.1;\r\n const maxSlopeCosine = Math.max(this.maxSlopeCosine, maxSlopeCosEps);\r\n const normalDotUp = contact.normal.dot(this.up);\r\n\r\n const contactPosition = contact.position.clone();\r\n if (normalDotUp > maxSlopeCosine) {\r\n const com = this.getPosition();\r\n const contactArm = this._tmpVecs[20];\r\n contact.position.subtractToRef(com, contactArm);\r\n const scale = contact.normal.dot(contactArm);\r\n contactPosition.x = com.x + this.up.x * scale;\r\n contactPosition.y = com.y + this.up.y * scale;\r\n contactPosition.z = com.z + this.up.z * scale;\r\n }\r\n\r\n const motionType = contact.bodyB.body.getMotionType(contact.bodyB.index);\r\n if (motionType != PhysicsMotionType.STATIC) {\r\n //<todo Need hknpMotionUtil::predictPontVelocity\r\n }\r\n\r\n const shift = constraint.velocity.dot(constraint.planeNormal) * timeTravelled;\r\n constraint.planeDistance -= shift;\r\n\r\n if (motionType == PhysicsMotionType.STATIC) {\r\n constraint.priority = 2;\r\n } else if (motionType == PhysicsMotionType.ANIMATED) {\r\n constraint.priority = 1;\r\n }\r\n\r\n return constraint;\r\n }\r\n\r\n protected _addMaxSlopePlane(maxSlopeCos: number, up: Vector3, index: number, constraints: ISurfaceConstraintInfo[], allowedPenetration: number): boolean {\r\n const verticalComponent = constraints[index].planeNormal.dot(up);\r\n if (verticalComponent > 0.01 && verticalComponent < maxSlopeCos) {\r\n const newConstraint = {\r\n planeNormal: constraints[index].planeNormal.clone(),\r\n planeDistance: constraints[index].planeDistance,\r\n velocity: constraints[index].velocity.clone(),\r\n angularVelocity: constraints[index].angularVelocity.clone(),\r\n priority: constraints[index].priority,\r\n dynamicFriction: constraints[index].dynamicFriction,\r\n staticFriction: constraints[index].staticFriction,\r\n extraDownStaticFriction: constraints[index].extraDownStaticFriction,\r\n extraUpStaticFriction: constraints[index].extraUpStaticFriction,\r\n };\r\n const distance = newConstraint.planeDistance;\r\n newConstraint.planeNormal.subtractInPlace(up.scale(verticalComponent));\r\n newConstraint.planeNormal.normalize();\r\n if (distance >= 0) {\r\n newConstraint.planeDistance = distance * newConstraint.planeNormal.dot(constraints[index].planeNormal);\r\n } else {\r\n const penetrationToResolve = Math.min(0, distance + allowedPenetration);\r\n newConstraint.planeDistance = penetrationToResolve / newConstraint.planeNormal.dot(constraints[index].planeNormal);\r\n constraints[index].planeDistance = 0;\r\n this._resolveConstraintPenetration(newConstraint, this.penetrationRecoverySpeed);\r\n }\r\n constraints.push(newConstraint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n protected _resolveConstraintPenetration(constraint: ISurfaceConstraintInfo, penetrationRecoverySpeed: number) {\r\n // If penetrating we add extra velocity to push the character back out\r\n const eps = 1e-6;\r\n if (constraint.planeDistance < -eps) {\r\n constraint.planeNormal.scaleToRef(constraint.planeDistance * penetrationRecoverySpeed, this._tmpVecs[6]);\r\n constraint.velocity.subtractInPlace(this._tmpVecs[6]);\r\n }\r\n }\r\n\r\n protected _createConstraintsFromManifold(dt: number, timeTravelled: number): ISurfaceConstraintInfo[] {\r\n const constraints = [];\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const surfaceConstraint = this._createSurfaceConstraint(this._manifold[i], timeTravelled);\r\n constraints.push(surfaceConstraint);\r\n this._addMaxSlopePlane(this.maxSlopeCosine, this.up, i, constraints, this._manifold[i].allowedPenetration);\r\n this._resolveConstraintPenetration(surfaceConstraint, this.penetrationRecoverySpeed);\r\n }\r\n return constraints;\r\n }\r\n\r\n protected _simplexSolverSortInfo(info: SimplexSolverInfo) {\r\n // simple bubble sort by (priority,velocity)\r\n for (let i = 0; i < info.numSupportPlanes - 1; i++) {\r\n for (let j = i + 1; j < info.numSupportPlanes; j++) {\r\n const p0 = info.supportPlanes[i];\r\n const p1 = info.supportPlanes[j];\r\n if (p0.constraint.priority < p1.constraint.priority) {\r\n continue;\r\n }\r\n if (p0.constraint.priority == p1.constraint.priority) {\r\n const vel0 = p0.constraint.velocity.lengthSquared();\r\n const vel1 = p1.constraint.velocity.lengthSquared();\r\n if (vel0 < vel1) {\r\n continue;\r\n }\r\n }\r\n info.supportPlanes[i] = p1;\r\n info.supportPlanes[j] = p0;\r\n }\r\n }\r\n }\r\n\r\n protected _simplexSolverSolve1d(info: SimplexSolverInfo, sci: ISurfaceConstraintInfo, velocityIn: Vector3, velocityOut: Vector3) {\r\n const eps = 1e-5;\r\n const groundVelocity = sci.velocity;\r\n const relativeVelocity = this._tmpVecs[22];\r\n velocityIn.subtractToRef(groundVelocity, relativeVelocity);\r\n\r\n const planeVel = relativeVelocity.dot(sci.planeNormal);\r\n\r\n const origVelocity2 = relativeVelocity.lengthSquared();\r\n relativeVelocity.subtractInPlace(sci.planeNormal.scale(planeVel));\r\n {\r\n const vp2 = planeVel * planeVel;\r\n // static friction is active if\r\n // velProjPlane * friction > |(velParallel)|\r\n // vplane * f > vpar\r\n // vp * f > vpar\r\n // vp2 * f2 > vpar2\r\n const extraStaticFriction = relativeVelocity.dot(this.up) > 0 ? sci.extraUpStaticFriction : sci.extraDownStaticFriction;\r\n if (extraStaticFriction > 0) {\r\n const horizontal = this.up.cross(sci.planeNormal);\r\n const hor2 = horizontal.lengthSquared();\r\n let horVel = 0.0;\r\n if (hor2 > eps) {\r\n horizontal.scaleInPlace(1 / Math.sqrt(hor2));\r\n\r\n horVel = relativeVelocity.dot(horizontal);\r\n\r\n // horizontal component\r\n {\r\n const horVel2 = horVel * horVel;\r\n const f2 = sci.staticFriction * sci.staticFriction;\r\n if (vp2 * f2 >= horVel2) {\r\n relativeVelocity.subtractInPlace(horizontal.scale(horVel));\r\n horVel = 0;\r\n }\r\n }\r\n }\r\n\r\n // vert component\r\n {\r\n const vertVel2 = origVelocity2 - horVel * horVel - vp2;\r\n const f2 = (sci.staticFriction + extraStaticFriction) * (sci.staticFriction + extraStaticFriction);\r\n if (vp2 * f2 >= vertVel2) {\r\n if (horVel == 0.0) {\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n }\r\n }\r\n } else {\r\n // static friction is active if\r\n // velProjPlane * friction > |(vel-velProjPlane)|\r\n // vp * f > rvProj\r\n //\r\n // -> vp * f >= rvProj\r\n // -> vp * f >= sqrt( vel^2 - vp^2 )\r\n // -> vp^2 ( f^2 + 1 ) >= vel^2\r\n const f2 = sci.staticFriction * sci.staticFriction;\r\n if (vp2 * (1 + f2) >= origVelocity2) {\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (sci.dynamicFriction < 1) {\r\n // apply dynamic friction 0 = conserve input velocity 1 = clip against normal\r\n const velOut2 = relativeVelocity.lengthSquared();\r\n if (velOut2 >= eps) {\r\n if (velOut2 > 1e-4 * origVelocity2) {\r\n let f = Math.sqrt(origVelocity2 / velOut2);\r\n f = sci.dynamicFriction + (1 - sci.dynamicFriction) * f;\r\n relativeVelocity.scaleInPlace(f);\r\n const p = sci.planeNormal.dot(relativeVelocity);\r\n relativeVelocity.subtractInPlace(sci.planeNormal.scale(p));\r\n }\r\n }\r\n }\r\n velocityOut.copyFrom(relativeVelocity);\r\n velocityOut.addInPlace(groundVelocity);\r\n }\r\n\r\n protected _simplexSolverSolveTest1d(sci: ISurfaceConstraintInfo, velocityIn: Vector3): boolean {\r\n const eps = 1e-3;\r\n const relativeVelocity = this._tmpVecs[23];\r\n velocityIn.subtractToRef(sci.velocity, relativeVelocity);\r\n return relativeVelocity.dot(sci.planeNormal) < -eps;\r\n }\r\n\r\n protected _simplexSolverSolve2d(\r\n info: SimplexSolverInfo,\r\n maxSurfaceVelocity: Vector3,\r\n sci0: ISurfaceConstraintInfo,\r\n sci1: ISurfaceConstraintInfo,\r\n velocityIn: Vector3,\r\n velocityOut: Vector3\r\n ) {\r\n const eps = 1e-5;\r\n const axis = sci0.planeNormal.cross(sci1.planeNormal);\r\n const axisLen2 = axis.lengthSquared();\r\n\r\n let solveSequentially = false;\r\n let axisVel = null;\r\n\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n // Check for parallel planes\r\n if (axisLen2 <= eps || solveSequentially) {\r\n info.getOutput(sci0).status = SurfaceConstraintInteractionStatus.FAILURE_2D;\r\n info.getOutput(sci1).status = SurfaceConstraintInteractionStatus.FAILURE_2D;\r\n\r\n if (sci0.priority > sci1.priority) {\r\n this._simplexSolverSolve1d(info, sci1, velocityIn, velocityOut);\r\n this._simplexSolverSolve1d(info, sci0, velocityIn, velocityOut);\r\n } else {\r\n this._simplexSolverSolve1d(info, sci0, velocityIn, velocityOut);\r\n this._simplexSolverSolve1d(info, sci1, velocityIn, velocityOut);\r\n }\r\n return;\r\n }\r\n\r\n const invAxisLen = 1.0 / Math.sqrt(axisLen2);\r\n axis.scaleInPlace(invAxisLen);\r\n\r\n // Calculate the velocity of the free axis\r\n {\r\n const r0 = sci0.planeNormal.cross(sci1.planeNormal);\r\n const r1 = sci1.planeNormal.cross(axis);\r\n const r2 = axis.cross(sci0.planeNormal);\r\n\r\n const sVel = sci0.velocity.add(sci1.velocity);\r\n\r\n const t = this._tmpVecs[2];\r\n t.set(0.5 * axis.dot(sVel), sci0.planeNormal.dot(sci0.velocity), sci1.planeNormal.dot(sci1.velocity));\r\n const m = Matrix.FromValues(r0.x, r1.x, r2.x, 0, r0.y, r1.y, r2.y, 0, r0.z, r1.z, r2.z, 0, 0, 0, 0, 1);\r\n axisVel = Vector3.TransformNormal(t, m);\r\n axisVel.scaleInPlace(invAxisLen);\r\n\r\n if (Math.abs(axisVel.x) > maxSurfaceVelocity.x || Math.abs(axisVel.y) > maxSurfaceVelocity.y || Math.abs(axisVel.z) > maxSurfaceVelocity.z) {\r\n solveSequentially = true;\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const groundVelocity = axisVel;\r\n const relativeVelocity = this._tmpVecs[24];\r\n velocityIn.subtractToRef(groundVelocity, relativeVelocity);\r\n\r\n const vel2 = relativeVelocity.lengthSquared();\r\n const axisVert = this.up.dot(axis);\r\n let axisProjVelocity = relativeVelocity.dot(axis);\r\n\r\n let staticFriction = sci0.staticFriction + sci1.staticFriction;\r\n if (axisVert * axisProjVelocity > 0) {\r\n staticFriction += (sci0.extraUpStaticFriction + sci1.extraUpStaticFriction) * axisVert;\r\n } else {\r\n staticFriction += (sci0.extraDownStaticFriction + sci1.extraDownStaticFriction) * axisVert;\r\n }\r\n staticFriction *= 0.5;\r\n\r\n const dynamicFriction = (sci0.dynamicFriction + sci1.dynamicFriction) * 0.5;\r\n // static friction is active if\r\n // |vel-axisProjVelocity|(rv) * friction(f) > axisProjVelocity(av)\r\n // -> sqrt( vel2 - av2 ) * f > av\r\n // -> (vel2 - av2) * f2 > av2\r\n const f2 = staticFriction * staticFriction;\r\n const av2 = axisProjVelocity * axisProjVelocity;\r\n if ((vel2 - av2) * f2 >= av2) {\r\n // static friction kicks in\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n\r\n if (dynamicFriction < 1) {\r\n // apply dynamic friction\r\n if (axisProjVelocity * axisProjVelocity > 1e-4 * vel2) {\r\n const tmp = 1.0 / axisProjVelocity;\r\n const f = Math.abs(tmp) * Math.sqrt(vel2) * (1.0 - dynamicFriction) + dynamicFriction;\r\n axisProjVelocity *= f;\r\n }\r\n }\r\n velocityOut.copyFrom(groundVelocity);\r\n velocityOut.addInPlace(axis.scale(axisProjVelocity));\r\n }\r\n\r\n protected _simplexSolverSolve3d(\r\n info: SimplexSolverInfo,\r\n maxSurfaceVelocity: Vector3,\r\n sci0: ISurfaceConstraintInfo,\r\n sci1: ISurfaceConstraintInfo,\r\n sci2: ISurfaceConstraintInfo,\r\n allowResort: boolean,\r\n velocityIn: Vector3,\r\n velocityOut: Vector3\r\n ) {\r\n const eps = 1e-5;\r\n // Calculate the velocity of the point axis\r\n let pointVel = null;\r\n {\r\n const r0 = sci1.planeNormal.cross(sci2.planeNormal);\r\n const r1 = sci2.planeNormal.cross(sci0.planeNormal);\r\n const r2 = sci0.planeNormal.cross(sci1.planeNormal);\r\n\r\n const det = r0.dot(sci0.planeNormal);\r\n let solveSequentially = false;\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n if (Math.abs(det) < eps || solveSequentially) {\r\n if (allowResort) {\r\n this._simplexSolverSortInfo(info);\r\n sci0 = info.supportPlanes[0].constraint;\r\n sci1 = info.supportPlanes[1].constraint;\r\n sci2 = info.supportPlanes[2].constraint;\r\n }\r\n info.getOutput(sci0).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n info.getOutput(sci1).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n info.getOutput(sci2).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n\r\n const oldNum = info.numSupportPlanes;\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci0, sci1, velocityIn, velocityOut);\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci0, sci2, velocityIn, velocityOut);\r\n }\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci1, sci2, velocityIn, velocityOut);\r\n }\r\n\r\n return;\r\n }\r\n\r\n const t = this._tmpVecs[2];\r\n t.set(sci0.planeNormal.dot(sci0.velocity), sci1.planeNormal.dot(sci1.velocity), sci2.planeNormal.dot(sci2.velocity));\r\n const m = Matrix.FromValues(r0.x, r0.y, r0.z, 0, r1.x, r1.y, r1.z, 0, r2.x, r2.y, r2.z, 0, 0, 0, 0, 1);\r\n pointVel = Vector3.TransformNormal(t, m);\r\n pointVel.scaleInPlace(1 / det);\r\n if (Math.abs(pointVel.x) > maxSurfaceVelocity.x || Math.abs(pointVel.y) > maxSurfaceVelocity.y || Math.abs(pointVel.z) > maxSurfaceVelocity.z) {\r\n solveSequentially = true;\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n velocityOut.copyFrom(pointVel);\r\n }\r\n\r\n protected _simplexSolverExamineActivePlanes(info: SimplexSolverInfo, maxSurfaceVelocity: Vector3, velocityIn: Vector3, velocityOut: Vector3) {\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n switch (info.numSupportPlanes) {\r\n case 1: {\r\n const sci = info.supportPlanes[0].constraint;\r\n this._simplexSolverSolve1d(info, sci, velocityIn, velocityOut);\r\n return;\r\n }\r\n case 2: {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve1d(info, info.supportPlanes[1].constraint, velocityIn, velocity);\r\n const plane0Used = this._simplexSolverSolveTest1d(info.supportPlanes[0].constraint, velocity);\r\n if (!plane0Used) {\r\n // Only need plane 1, so remove plane 0\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[1]);\r\n info.numSupportPlanes = 1;\r\n velocityOut.copyFrom(velocity);\r\n } else {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, info.supportPlanes[0].constraint, info.supportPlanes[1].constraint, velocityIn, velocityOut);\r\n }\r\n return;\r\n }\r\n case 3: {\r\n // Try to drop both planes\r\n {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve1d(info, info.supportPlanes[2].constraint, velocityIn, velocityOut);\r\n\r\n const plane0Used = this._simplexSolverSolveTest1d(info.supportPlanes[0].constraint, velocity);\r\n if (!plane0Used) {\r\n const plane1Used = this._simplexSolverSolveTest1d(info.supportPlanes[1].constraint, velocity);\r\n if (!plane1Used) {\r\n velocityOut.copyFrom(velocity);\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[2]);\r\n info.numSupportPlanes = 1;\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n // Try to drop plane 0 or 1\r\n {\r\n let droppedAPlane = false;\r\n for (let testPlane = 0; testPlane < 2; testPlane++) {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve2d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[testPlane].constraint,\r\n info.supportPlanes[2].constraint,\r\n velocityIn,\r\n velocityOut\r\n );\r\n const planeUsed = this._simplexSolverSolveTest1d(info.supportPlanes[1 - testPlane].constraint, velocity);\r\n if (!planeUsed) {\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[testPlane]);\r\n info.supportPlanes[1].copyFrom(info.supportPlanes[2]);\r\n info.numSupportPlanes--;\r\n droppedAPlane = true;\r\n break;\r\n }\r\n }\r\n\r\n if (droppedAPlane) {\r\n continue;\r\n }\r\n }\r\n\r\n // Otherwise, try and solve all three planes:\r\n this._simplexSolverSolve3d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[0].constraint,\r\n info.supportPlanes[1].constraint,\r\n info.supportPlanes[2].constraint,\r\n true,\r\n velocityIn,\r\n velocityOut\r\n );\r\n return;\r\n }\r\n case 4: {\r\n this._simplexSolverSortInfo(info);\r\n let droppedAPlane = false;\r\n\r\n for (let i = 0; i < 3; i++) {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve3d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[(i + 1) % 3].constraint,\r\n info.supportPlanes[(i + 2) % 3].constraint,\r\n info.supportPlanes[3].constraint,\r\n false,\r\n velocityIn,\r\n velocity\r\n );\r\n const planeUsed = this._simplexSolverSolveTest1d(info.supportPlanes[i].constraint, velocity);\r\n if (!planeUsed) {\r\n info.supportPlanes[i].copyFrom(info.supportPlanes[2]);\r\n info.supportPlanes[2].copyFrom(info.supportPlanes[3]);\r\n info.numSupportPlanes = 3;\r\n droppedAPlane = true;\r\n break;\r\n }\r\n }\r\n\r\n if (droppedAPlane) {\r\n continue;\r\n }\r\n\r\n // Nothing can be dropped so we've failed to solve\r\n // Now we try all 3d combinations\r\n {\r\n const velocity = velocityIn.clone();\r\n const sci0 = info.supportPlanes[0].constraint;\r\n const sci1 = info.supportPlanes[1].constraint;\r\n const sci2 = info.supportPlanes[2].constraint;\r\n const sci3 = info.supportPlanes[3].constraint;\r\n const oldNum = info.numSupportPlanes;\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci1, sci2, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci1, sci3, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci2, sci3, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci1, sci2, sci3, false, velocity, velocity);\r\n }\r\n\r\n velocityOut.copyFrom(velocity);\r\n }\r\n\r\n // Search a plane to drop\r\n {\r\n // Search the highest penalty value\r\n let maxStatus = SurfaceConstraintInteractionStatus.OK;\r\n for (let i = 0; i < 4; i++) {\r\n maxStatus = Math.max(maxStatus, info.supportPlanes[i].interaction.status);\r\n }\r\n\r\n // Remove the place with the lowest priority and the highest penalty\r\n let i = 0;\r\n for (; i < 4; i++) {\r\n if (maxStatus == info.supportPlanes[i].interaction.status) {\r\n info.supportPlanes[i].copyFrom(info.supportPlanes[3]);\r\n break;\r\n }\r\n info.numSupportPlanes--;\r\n }\r\n }\r\n\r\n // Clear penalty flags for the other planes\r\n for (let i = 0; i < 3; i++) {\r\n info.supportPlanes[i].interaction.status = SurfaceConstraintInteractionStatus.OK;\r\n }\r\n\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _simplexSolverSolve(\r\n constraints: ISurfaceConstraintInfo[],\r\n velocity: Vector3,\r\n deltaTime: number,\r\n minDeltaTime: number,\r\n up: Vector3,\r\n maxSurfaceVelocity: Vector3\r\n ): SimplexSolverOutput {\r\n const eps = 1e-6;\r\n const output = new SimplexSolverOutput();\r\n output.position = Vector3.Zero();\r\n output.velocity = velocity.clone();\r\n output.planeInteractions = [];\r\n let remainingTime = deltaTime;\r\n\r\n for (let i = 0; i < constraints.length; i++) {\r\n output.planeInteractions.push({\r\n touched: false,\r\n stopped: false,\r\n surfaceTime: 0,\r\n penaltyDistance: 0,\r\n status: SurfaceConstraintInteractionStatus.OK,\r\n });\r\n }\r\n\r\n const info = new SimplexSolverInfo();\r\n info.inputConstraints = constraints;\r\n info.outputInteractions = output.planeInteractions;\r\n info.supportPlanes[0] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[1] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[2] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[3] = new SimplexSolverActivePlanes();\r\n\r\n while (remainingTime > 0) {\r\n // search for a plane which collides our current direction\r\n let hitIndex = -1;\r\n let minCollisionTime = remainingTime;\r\n for (let i = 0; i < constraints.length; i++) {\r\n // Do not search existing active planes\r\n if (info.numSupportPlanes >= 1 && info.supportPlanes[0].index == i) {\r\n continue;\r\n }\r\n if (info.numSupportPlanes >= 2 && info.supportPlanes[1].index == i) {\r\n continue;\r\n }\r\n if (info.numSupportPlanes >= 3 && info.supportPlanes[2].index == i) {\r\n continue;\r\n }\r\n if (output.planeInteractions[i].status != SurfaceConstraintInteractionStatus.OK) {\r\n continue;\r\n }\r\n\r\n // Try to find the plane with the shortest time to move\r\n const sci = constraints[i];\r\n const relativeVel = this._tmpVecs[25];\r\n output.velocity.subtractToRef(sci.velocity, relativeVel);\r\n const relativeProjectedVel = -relativeVel.dot(sci.planeNormal);\r\n // if projected velocity is pointing away skip it\r\n if (relativeProjectedVel <= 0) {\r\n continue;\r\n }\r\n\r\n // Calculate the time of impact\r\n const relativePos = this._tmpVecs[26];\r\n sci.velocity.scaleToRef(info.currentTime, this._tmpVecs[27]);\r\n output.position.subtractToRef(this._tmpVecs[27], relativePos);\r\n let projectedPos = sci.planeNormal.dot(relativePos);\r\n\r\n // treat penetrations\r\n const penaltyDist = output.planeInteractions[i].penaltyDistance;\r\n if (penaltyDist < eps) {\r\n projectedPos = 0;\r\n }\r\n projectedPos += penaltyDist;\r\n\r\n // check for new hit\r\n if (projectedPos < minCollisionTime * relativeProjectedVel) {\r\n minCollisionTime = projectedPos / relativeProjectedVel;\r\n hitIndex = i;\r\n }\r\n }\r\n\r\n // integrate: Walk to our hitPosition we must walk more than 10 microseconds into the future to consider it valid.\r\n const minAcceptableCollisionTime = 1e-4;\r\n if (minCollisionTime > minAcceptableCollisionTime) {\r\n info.currentTime += minCollisionTime;\r\n remainingTime -= minCollisionTime;\r\n output.position.addInPlace(output.velocity.scale(minCollisionTime));\r\n for (let i = 0; i < info.numSupportPlanes; i++) {\r\n info.supportPlanes[i].interaction.surfaceTime += minCollisionTime;\r\n info.supportPlanes[i].interaction.touched = true;\r\n }\r\n\r\n output.deltaTime = info.currentTime;\r\n if (info.currentTime > minDeltaTime) {\r\n return output;\r\n }\r\n }\r\n\r\n // If we have no hit than we are done\r\n if (hitIndex < 0) {\r\n output.deltaTime = deltaTime;\r\n break;\r\n }\r\n\r\n // Add our hit to our current list of active planes\r\n const supportPlane = info.supportPlanes[info.numSupportPlanes++];\r\n supportPlane.constraint = constraints[hitIndex];\r\n supportPlane.interaction = output.planeInteractions[hitIndex];\r\n supportPlane.interaction.penaltyDistance = (supportPlane.interaction.penaltyDistance + eps) * 2.0;\r\n supportPlane.index = hitIndex;\r\n\r\n // Move our character along the current set of active planes\r\n this._simplexSolverExamineActivePlanes(info, maxSurfaceVelocity, velocity, output.velocity);\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Compute a CharacterSurfaceInfo from current state and a direction\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param direction direction to check, usually gravity direction\r\n * @returns a CharacterSurfaceInfo object\r\n */\r\n public checkSupport(deltaTime: number, direction: Vector3): CharacterSurfaceInfo {\r\n const surfaceInfo = {\r\n isSurfaceDynamic: false,\r\n supportedState: CharacterSupportedState.UNSUPPORTED,\r\n averageSurfaceNormal: Vector3.Zero(),\r\n averageSurfaceVelocity: Vector3.Zero(),\r\n averageAngularSurfaceVelocity: Vector3.Zero(),\r\n };\r\n this.checkSupportToRef(deltaTime, direction, surfaceInfo);\r\n return surfaceInfo;\r\n }\r\n\r\n /**\r\n * Compute a CharacterSurfaceInfo from current state and a direction\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param direction direction to check, usually gravity direction\r\n * @param surfaceInfo output for surface info\r\n */\r\n public checkSupportToRef(deltaTime: number, direction: Vector3, surfaceInfo: CharacterSurfaceInfo): void {\r\n const eps = 1e-4;\r\n\r\n this._validateManifold();\r\n const constraints = this._createConstraintsFromManifold(deltaTime, 0.0);\r\n const storedVelocities: Vector3[] = [];\r\n // Remove velocities and friction to make this a query of the static geometry\r\n for (let i = 0; i < constraints.length; i++) {\r\n storedVelocities.push(constraints[i].velocity.clone());\r\n constraints[i].velocity.setAll(0);\r\n }\r\n\r\n const maxSurfaceVelocity = this._tmpVecs[3];\r\n maxSurfaceVelocity.set(this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver);\r\n const output = this._simplexSolverSolve(constraints, direction, deltaTime, deltaTime, this.up, maxSurfaceVelocity);\r\n\r\n surfaceInfo.averageSurfaceVelocity.setAll(0);\r\n surfaceInfo.averageAngularSurfaceVelocity.setAll(0);\r\n surfaceInfo.averageSurfaceNormal.setAll(0);\r\n surfaceInfo.isSurfaceDynamic = false;\r\n\r\n // If the constraints did not affect the character movement then it is unsupported and we can finish\r\n if (output.velocity.equalsWithEpsilon(direction, eps)) {\r\n surfaceInfo.supportedState = CharacterSupportedState.UNSUPPORTED;\r\n return;\r\n }\r\n\r\n // Check how was the input velocity modified to determine if the character is supported or sliding\r\n if (output.velocity.lengthSquared() < eps) {\r\n surfaceInfo.supportedState = CharacterSupportedState.SUPPORTED;\r\n } else {\r\n output.velocity.normalize();\r\n const angleSin = output.velocity.dot(direction);\r\n const cosSqr = 1 - angleSin * angleSin;\r\n if (cosSqr < this.maxSlopeCosine * this.maxSlopeCosine) {\r\n surfaceInfo.supportedState = CharacterSupportedState.SLIDING;\r\n } else {\r\n surfaceInfo.supportedState = CharacterSupportedState.SUPPORTED;\r\n }\r\n }\r\n\r\n // Add all supporting constraints to the ground information\r\n let numTouching = 0;\r\n for (let i = -0; i < constraints.length; i++) {\r\n if (output.planeInteractions[i].touched && constraints[i].planeNormal.dot(direction) < -0.08) {\r\n surfaceInfo.averageSurfaceNormal.addInPlace(constraints[i].planeNormal);\r\n surfaceInfo.averageSurfaceVelocity.addInPlace(storedVelocities[i]);\r\n surfaceInfo.averageAngularSurfaceVelocity.addInPlace(constraints[i].angularVelocity);\r\n numTouching++;\r\n }\r\n }\r\n\r\n if (numTouching > 0) {\r\n surfaceInfo.averageSurfaceNormal.normalize();\r\n surfaceInfo.averageSurfaceVelocity.scaleInPlace(1 / numTouching);\r\n surfaceInfo.averageAngularSurfaceVelocity.scaleInPlace(1 / numTouching);\r\n }\r\n\r\n // isSurfaceDynamic update\r\n if (surfaceInfo.supportedState == CharacterSupportedState.SUPPORTED) {\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const manifold = this._manifold[i];\r\n const bodyB = manifold.bodyB;\r\n\r\n if (this._manifold[i].normal.dot(direction) < -0.08 && bodyB.body.getMotionType(0) == PhysicsMotionType.DYNAMIC) {\r\n surfaceInfo.isSurfaceDynamic = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _castWithCollectors(startPos: Vector3, endPos: Vector3, castCollector: any /*HP_CollectorId*/, startCollector?: any /*HP_CollectorId*/) {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n const startNative = [startPos.x, startPos.y, startPos.z];\r\n const orientation = [this._orientation.x, this._orientation.y, this._orientation.z, this._orientation.w];\r\n if (startCollector != null) {\r\n const query /*: ShapeProximityInput*/ = [\r\n this._shape._pluginData,\r\n startNative,\r\n orientation,\r\n this.keepDistance + this.keepContactTolerance, // max distance\r\n false, // should hit triggers\r\n [BigInt(0)], // body to ignore //<todo allow for a proxy body!\r\n ];\r\n hknp.HP_World_ShapeProximityWithCollector(hk.world, startCollector, query);\r\n }\r\n\r\n {\r\n const query /*: ShapeCastInput*/ = [\r\n this._shape._pluginData,\r\n orientation,\r\n startNative,\r\n [endPos.x, endPos.y, endPos.z],\r\n false, // should hit triggers\r\n [BigInt(0)], // body to ignore //<todo allow for proxy body\r\n ];\r\n hknp.HP_World_ShapeCastWithCollector(hk.world, castCollector, query);\r\n }\r\n }\r\n\r\n protected _resolveContacts(deltaTime: number, gravity: Vector3) {\r\n const eps = 1e-12;\r\n //<todo object interactions out\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const contact = this._manifold[i];\r\n const bodyB = this._manifold[i].bodyB;\r\n\r\n //<todo test if bodyB is another character with a proxy body\r\n\r\n // Skip fixed or keyframed bodies as we won't apply impulses to them\r\n if (bodyB.body.getMotionType(bodyB.index) != PhysicsMotionType.DYNAMIC) {\r\n continue;\r\n }\r\n\r\n // Calculate and apply impulse on contacted body\r\n {\r\n //<todo input/output for callbacks\r\n let inputObjectMassInv = 0;\r\n let inputObjectImpulse = 0;\r\n let outputObjectImpulse = Vector3.Zero();\r\n const outputImpulsePosition = contact.position;\r\n\r\n // Calculate relative normal velocity of the contact point in the contacted body\r\n const pointRelVel = this._tmpVecs[19];\r\n this._getPointVelocityToRef(bodyB, contact.position, pointRelVel);\r\n pointRelVel.subtractInPlace(this._velocity);\r\n const inputProjectedVelocity = pointRelVel.dot(contact.normal);\r\n const dampFactor = 0.9;\r\n\r\n // Change velocity\r\n let deltaVelocity = -inputProjectedVelocity * dampFactor;\r\n\r\n // Apply an extra impulse if the collision is actually penetrating\r\n if (contact.distance < 0) {\r\n const recoveryTau = 0.4;\r\n deltaVelocity += (contact.distance * recoveryTau) / deltaTime;\r\n }\r\n\r\n // Apply impulse if required to keep bodies apart\r\n if (deltaVelocity < 0) {\r\n // Calculate the impulse magnitude\r\n const invInertia = this._getInverseInertiaWorld(bodyB);\r\n const comWorld = this._tmpVecs[15];\r\n this._getComWorldToRef(bodyB, comWorld);\r\n const r = this._tmpVecs[16];\r\n contact.position.subtractToRef(comWorld, r);\r\n const jacAng = this._tmpVecs[17];\r\n Vector3.CrossToRef(r, contact.normal, jacAng);\r\n const rc = this._tmpVecs[18];\r\n Vector3.TransformNormalToRef(jacAng, invInertia, rc);\r\n inputObjectMassInv = rc.dot(jacAng) + this._getInvMass(bodyB);\r\n inputObjectImpulse = deltaVelocity / inputObjectMassInv;\r\n\r\n // Clamp impulse magnitude if required and apply it to the normal direction\r\n const maxPushImpulse = -this.characterStrength * deltaTime;\r\n if (inputObjectImpulse < maxPushImpulse) {\r\n inputObjectImpulse = maxPushImpulse;\r\n }\r\n outputObjectImpulse = contact.normal.scale(inputObjectImpulse);\r\n } else {\r\n inputObjectImpulse = 0;\r\n inputObjectMassInv = this._getInvMass(bodyB);\r\n }\r\n\r\n // Add gravity\r\n {\r\n // Calculate effect of gravity on the velocity of the character in the contact normal direction\r\n let relVelN = contact.normal.dot(gravity.scale(deltaTime));\r\n // If it is a separating contact subtract the separation velocity\r\n if (inputProjectedVelocity < 0) {\r\n relVelN -= inputProjectedVelocity;\r\n }\r\n // If the resulting velocity is negative an impulse is applied to stop the character from falling into\r\n // the contacted body\r\n if (relVelN < -eps) {\r\n outputObjectImpulse.addInPlace(contact.normal.scale(this.characterMass * relVelN));\r\n }\r\n }\r\n\r\n //<todo Fire callback to allow user to change impulse + use the info / play sounds\r\n\r\n bodyB.body.applyImpulse(outputObjectImpulse, outputImpulsePosition, bodyB.index);\r\n }\r\n }\r\n }\r\n\r\n protected _getInverseInertiaWorld(body: { body: PhysicsBody; index: number }): DeepImmutableObject<Matrix> {\r\n const mp = body.body.getMassProperties(body.index);\r\n if (!mp.inertia || !mp.inertiaOrientation) {\r\n return Matrix.IdentityReadOnly;\r\n }\r\n const invOrientation = Matrix.FromQuaternionToRef(mp.inertiaOrientation, TmpVectors.Matrix[0]).invert();\r\n const it = TmpVectors.Matrix[1];\r\n\r\n const ir = invOrientation.getRowToRef(0, TmpVectors.Vector4[0]);\r\n it.setRowFromFloats(0, mp.inertia.x * ir.x, mp.inertia.x * ir.y, mp.inertia.x * ir.z, 0);\r\n invOrientation.getRowToRef(1, ir);\r\n it.setRowFromFloats(0, mp.inertia.y * ir.x, mp.inertia.y * ir.y, mp.inertia.y * ir.z, 0);\r\n invOrientation.getRowToRef(2, ir);\r\n it.setRowFromFloats(0, mp.inertia.z * ir.x, mp.inertia.z * ir.y, mp.inertia.z * ir.z, 0);\r\n invOrientation.multiplyToRef(it, this._tmpMatrix);\r\n return this._tmpMatrix;\r\n }\r\n\r\n protected _getComWorldToRef(body: { body: PhysicsBody; index: number }, result: Vector3) {\r\n const mp = body.body.getMassProperties(body.index);\r\n Vector3.TransformCoordinatesToRef(mp.centerOfMass!, body.body.transformNode.getWorldMatrix(), result);\r\n }\r\n\r\n protected _getInvMass(body: { body: PhysicsBody; index: number }): number {\r\n return 1 / body.body.getMassProperties(body.index).mass!;\r\n }\r\n\r\n /**\r\n * Update internal state. Must be called once per frame\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param surfaceInfo surface information returned by checkSupport\r\n * @param gravity gravity applied to the character. Can be different that world gravity\r\n */\r\n public integrate(deltaTime: number, surfaceInfo: CharacterSurfaceInfo, gravity: Vector3) {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n\r\n const invDeltaTime = 1 / deltaTime;\r\n let remainingTime = deltaTime;\r\n let newVelocity = Vector3.Zero();\r\n\r\n // If the difference between the cast displacement and the simplex solver output position is less than this\r\n // value (per component), do not do a second cast to check if it's possible to reach the output position.\r\n const displacementEps = 1e-4;\r\n const epsSqrd = 1e-8;\r\n\r\n // Choose the first cast direction. If velocity hasn't changed from the previous integrate, guess that the\r\n // displacement will be the same as last integrate, scaled by relative step length. Otherwise, guess based\r\n // on current velocity.\r\n {\r\n const tolerance = displacementEps * invDeltaTime;\r\n if (this._velocity.equalsWithEpsilon(this._lastVelocity, tolerance)) {\r\n this._lastDisplacement.scaleInPlace(remainingTime * this._lastInvDeltaTime);\r\n } else {\r\n const displacementVelocity = this._velocity;\r\n if (surfaceInfo.supportedState == CharacterSupportedState.SUPPORTED) {\r\n const relativeVelocity = this._tmpVecs[28];\r\n this._velocity.subtractToRef(surfaceInfo.averageSurfaceVelocity, relativeVelocity);\r\n const normalDotVelocity = surfaceInfo.averageSurfaceNormal.dot(relativeVelocity);\r\n if (normalDotVelocity < 0) {\r\n relativeVelocity.subtractInPlace(surfaceInfo.averageSurfaceNormal.scale(normalDotVelocity));\r\n displacementVelocity.copyFrom(relativeVelocity);\r\n displacementVelocity.addInPlace(surfaceInfo.averageSurfaceVelocity);\r\n }\r\n }\r\n this._lastDisplacement.copyFrom(displacementVelocity);\r\n this._lastDisplacement.scaleInPlace(remainingTime);\r\n }\r\n this._lastVelocity.copyFrom(this._velocity);\r\n this._lastInvDeltaTime = invDeltaTime;\r\n }\r\n\r\n // Make sure that contact with bodies that have been removed since the call to checkSupport() are removed from the\r\n // manifold\r\n this._validateManifold();\r\n\r\n for (let iter = 0; iter < this.maxCastIterations && remainingTime > 1e-5; iter++) {\r\n this._castWithCollectors(this._position, this._position.add(this._lastDisplacement), this._castCollector, this._startCollector);\r\n const updateResult = this._updateManifold(this._startCollector, this._castCollector, this._lastDisplacement);\r\n\r\n // Create surface constraints from the manifold contacts.\r\n const constraints = this._createConstraintsFromManifold(deltaTime, deltaTime - remainingTime);\r\n const maxSurfaceVelocity = this._tmpVecs[3];\r\n maxSurfaceVelocity.set(this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver);\r\n const minDeltaTime = this._velocity.lengthSquared() == 0 ? 0.0 : (0.5 * this.keepDistance) / this._velocity.length();\r\n const solveResults = this._simplexSolverSolve(constraints, this._velocity, remainingTime, minDeltaTime, this.up, maxSurfaceVelocity);\r\n const newDisplacement = solveResults.position;\r\n const solverDeltaTime = solveResults.deltaTime;\r\n newVelocity = solveResults.velocity;\r\n\r\n this._resolveContacts(deltaTime, gravity);\r\n\r\n let newContactIndex = -1;\r\n // todo if (updateResult == hit multiple bodies) ... cast again\r\n\r\n // If castCollector had hits on different bodies (so we're not sure if some non-closest body could be in our way) OR\r\n // the simplex has given an output direction different from the cast guess\r\n // we re-cast to check we can move there. There is no need to get the start points again.\r\n if (updateResult != 0 || (newDisplacement.lengthSquared() > epsSqrd && !this._lastDisplacement.equalsWithEpsilon(newDisplacement, displacementEps))) {\r\n this._castWithCollectors(this._position, this._position.add(newDisplacement), this._castCollector, this._startCollector);\r\n const hknp = hk._hknp;\r\n const numCastHits = hknp.HP_QueryCollector_GetNumHits(this._castCollector)[1];\r\n // Find the first contact that isn't already in the manifold\r\n if (numCastHits > 0) {\r\n //<todo sortHits()\r\n for (let i = 0; i < numCastHits; i++) {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const [fraction, _hitLocal, hitWorld] = hknp.HP_QueryCollector_GetShapeCastResult(this._castCollector, i)[1];\r\n const newContact = ContactFromCast(hk, hitWorld, newDisplacement, fraction, this.keepDistance);\r\n if (this._findContact(newContact, this._manifold, 0.1) == -1) {\r\n //<todo fireContactAdded\r\n newContactIndex = this._manifold.length;\r\n this._manifold.push(newContact);\r\n //<todo updateTriggersSeen()\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (newContactIndex >= 0) {\r\n const newContact = this._manifold[newContactIndex];\r\n const displacementLengthInv = 1.0 / newDisplacement.length();\r\n const angleBetweenMovementAndSurface = newDisplacement.dot(newContact.normal) * displacementLengthInv;\r\n const keepDistanceAlongMovement = this.keepDistance / -angleBetweenMovementAndSurface;\r\n const distance = newContact.fraction;\r\n let fraction = distance - keepDistanceAlongMovement * displacementLengthInv;\r\n fraction = Math.min(Math.max(fraction, 0.0), 1.0);\r\n\r\n const displacement = newDisplacement.scale(fraction);\r\n this._position.addInPlace(displacement);\r\n remainingTime -= solverDeltaTime * fraction;\r\n } else {\r\n this._position.addInPlace(newDisplacement);\r\n remainingTime -= solverDeltaTime;\r\n }\r\n this._lastDisplacement.copyFrom(newDisplacement);\r\n }\r\n\r\n this._velocity.copyFrom(newVelocity);\r\n }\r\n\r\n /**\r\n * Helper function to calculate velocity based on surface informations and current velocity state and target\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param forwardWorld character forward in world coordinates\r\n * @param surfaceNormal surface normal direction\r\n * @param currentVelocity current velocity\r\n * @param surfaceVelocity velocity induced by the surface\r\n * @param desiredVelocity desired character velocity\r\n * @param upWorld up vector in world space\r\n * @param result resulting velocity vector\r\n * @returns boolean true if result has been computed\r\n */\r\n public calculateMovementToRef(\r\n deltaTime: number,\r\n forwardWorld: Vector3,\r\n surfaceNormal: Vector3,\r\n currentVelocity: Vector3,\r\n surfaceVelocity: Vector3,\r\n desiredVelocity: Vector3,\r\n upWorld: Vector3,\r\n result: Vector3\r\n ): boolean {\r\n const eps = 1e-5;\r\n let binorm = forwardWorld.cross(upWorld);\r\n if (binorm.lengthSquared() < eps) {\r\n return false;\r\n }\r\n binorm.normalize();\r\n const tangent = binorm.cross(surfaceNormal);\r\n tangent.normalize();\r\n binorm = tangent.cross(surfaceNormal);\r\n binorm.normalize();\r\n\r\n const surfaceFrame = Matrix.FromValues(\r\n tangent.x,\r\n tangent.y,\r\n tangent.z,\r\n 0,\r\n binorm.x,\r\n binorm.y,\r\n binorm.z,\r\n 0,\r\n surfaceNormal.x,\r\n surfaceNormal.y,\r\n surfaceNormal.z,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1\r\n );\r\n const invSurfaceFrame = surfaceFrame.clone().invert();\r\n\r\n currentVelocity.subtractToRef(surfaceVelocity, this._tmpVecs[29]);\r\n const relative = this._tmpVecs[30];\r\n Vector3.TransformNormalToRef(this._tmpVecs[29], invSurfaceFrame, relative);\r\n\r\n const sideVec = upWorld.cross(forwardWorld);\r\n const fwd = desiredVelocity.dot(forwardWorld);\r\n const side = desiredVelocity.dot(sideVec);\r\n const len = desiredVelocity.length();\r\n\r\n const desiredVelocitySF = this._tmpVecs[4];\r\n desiredVelocitySF.set(-fwd, side, 0);\r\n desiredVelocitySF.normalize();\r\n desiredVelocitySF.scaleInPlace(len);\r\n const diff = this._tmpVecs[5];\r\n desiredVelocitySF.subtractToRef(relative, diff);\r\n\r\n // Clamp it by maxAcceleration and limit it by gain.\r\n {\r\n const lenSq = diff.lengthSquared();\r\n const maxVelocityDelta = this.maxAcceleration * deltaTime;\r\n let tmp: number;\r\n if (lenSq * this.acceleration * this.acceleration > maxVelocityDelta * maxVelocityDelta) {\r\n tmp = maxVelocityDelta / Math.sqrt(lenSq);\r\n } else {\r\n tmp = this.acceleration;\r\n }\r\n diff.scaleInPlace(tmp);\r\n }\r\n\r\n relative.addInPlace(diff);\r\n\r\n // Transform back to world space and apply\r\n Vector3.TransformNormalToRef(relative, surfaceFrame, result);\r\n\r\n // Add back in the surface velocity\r\n result.addInPlace(surfaceVelocity);\r\n return true;\r\n }\r\n\r\n /**\r\n * Helper function to calculate velocity based on surface informations and current velocity state and target\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param forwardWorld character forward in world coordinates\r\n * @param surfaceNormal surface normal direction\r\n * @param currentVelocity current velocity\r\n * @param surfaceVelocity velocity induced by the surface\r\n * @param desiredVelocity desired character velocity\r\n * @param upWorld up vector in world space\r\n * @returns a new velocity vector\r\n */\r\n public calculateMovement(\r\n deltaTime: number,\r\n forwardWorld: Vector3,\r\n surfaceNormal: Vector3,\r\n currentVelocity: Vector3,\r\n surfaceVelocity: Vector3,\r\n desiredVelocity: Vector3,\r\n upWorld: Vector3\r\n ): Vector3 {\r\n const result = new Vector3(0, 0, 0);\r\n this.calculateMovementToRef(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld, result);\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"characterController.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/characterController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGlF,OAAO,EAAE,WAAW,EAAE,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a,EAAE,CAAC;YACnC,MAAM,gBAAgB,GAAG,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;YAC1D,IAAI,GAAW,CAAC;YAChB,IAAI,KAAK,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,GAAG,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;gBACtF,GAAG,GAAG,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACJ,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC;YAC5B,CAAC;YACD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QAED,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAE1B,0CAA0C;QAC1C,OAAO,CAAC,oBAAoB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QAE7D,mCAAmC;QACnC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;;;;;OAUG;IACI,iBAAiB,CACpB,SAAiB,EACjB,YAAqB,EACrB,aAAsB,EACtB,eAAwB,EACxB,eAAwB,EACxB,eAAwB,EACxB,OAAgB;QAEhB,MAAM,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,sBAAsB,CAAC,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACxI,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import { Vector3, Quaternion, Matrix, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { DeepImmutableObject } from \"../../types\";\r\nimport { PhysicsBody } from \"./physicsBody\";\r\nimport { PhysicsShapeCapsule, type PhysicsShape } from \"./physicsShape\";\r\nimport { PhysicsMotionType } from \"./IPhysicsEnginePlugin\";\r\nimport type { HavokPlugin } from \"./Plugins/havokPlugin\";\r\nimport { BuildArray } from \"core/Misc/arrayTools\";\r\nimport { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Observable } from \"../../Misc/observable\";\r\n\r\n/**\r\n * Shape properties for the character controller\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface CharacterShapeOptions {\r\n /**\r\n * optional shape used for collision detection\r\n */\r\n shape?: PhysicsShape;\r\n /**\r\n * capsule height for the capsule shape if no shape is provided\r\n */\r\n capsuleHeight?: number;\r\n /**\r\n * capsule radius for the capsule shape if no shape is provided\r\n */\r\n capsuleRadius?: number;\r\n}\r\n\r\n/**\r\n * Collision event data for the character controller\r\n */\r\nexport interface ICharacterControllerCollisionEvent {\r\n /**\r\n * The collider physics body\r\n */\r\n collider: PhysicsBody;\r\n /**\r\n *\r\n */\r\n colliderIndex: number;\r\n /**\r\n * Separation force applied to the collider\r\n */\r\n impulse: Vector3;\r\n /**\r\n * Position where the impulse is applied\r\n */\r\n impulsePosition: Vector3;\r\n}\r\n\r\n/**\r\n * State of the character on the surface\r\n */\r\nexport const enum CharacterSupportedState {\r\n UNSUPPORTED,\r\n SLIDING,\r\n SUPPORTED,\r\n}\r\n\r\n/**\r\n * Surface information computed by checkSupport method\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface CharacterSurfaceInfo {\r\n /**\r\n * Indicates whether the surface is dynamic.\r\n * A dynamic surface is one that can change its properties over time,\r\n * such as moving platforms or surfaces that can be affected by external forces.\r\n * surfaceInfo.supportedState is always CharacterSupportedState.SUPPORTED when isSurfaceDynamic is true.\r\n */\r\n isSurfaceDynamic: boolean;\r\n /**\r\n * The supported state of the character on the surface.\r\n */\r\n supportedState: CharacterSupportedState;\r\n /**\r\n * The average normal vector of the surface.\r\n * This vector is perpendicular to the surface and points outwards.\r\n */\r\n averageSurfaceNormal: Vector3;\r\n /**\r\n * The average velocity of the surface.\r\n * This vector represents the speed and direction in which the surface is moving.\r\n */\r\n averageSurfaceVelocity: Vector3;\r\n /**\r\n * The average angular velocity of the surface.\r\n */\r\n averageAngularSurfaceVelocity: Vector3;\r\n}\r\n\r\ninterface IContact {\r\n /** @internal */\r\n position: Vector3;\r\n /** @internal */\r\n normal: Vector3;\r\n /** @internal */\r\n distance: number;\r\n /** @internal */\r\n fraction: number;\r\n /** @internal */\r\n bodyB: { body: PhysicsBody; index: number };\r\n /** @internal */\r\n allowedPenetration: number;\r\n}\r\n\r\ninterface ISurfaceConstraintInfo {\r\n /** @internal */\r\n planeNormal: Vector3;\r\n /** @internal */\r\n planeDistance: number;\r\n /** @internal */\r\n velocity: Vector3;\r\n /** @internal */\r\n angularVelocity: Vector3;\r\n /** @internal */\r\n staticFriction: number;\r\n /** @internal */\r\n extraUpStaticFriction: number;\r\n /** @internal */\r\n extraDownStaticFriction: number;\r\n /** @internal */\r\n dynamicFriction: number;\r\n /** @internal */\r\n priority: number;\r\n}\r\n\r\nconst enum SurfaceConstraintInteractionStatus {\r\n OK,\r\n FAILURE_3D,\r\n FAILURE_2D,\r\n}\r\ninterface ISurfaceConstraintInteraction {\r\n /** @internal */\r\n touched: boolean;\r\n /** @internal */\r\n stopped: boolean;\r\n /** @internal */\r\n surfaceTime: number;\r\n /** @internal */\r\n penaltyDistance: number;\r\n /** @internal */\r\n status: SurfaceConstraintInteractionStatus;\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverOutput {\r\n /** @internal */\r\n public position: Vector3;\r\n /** @internal */\r\n public velocity: Vector3;\r\n /** @internal */\r\n public deltaTime: number;\r\n /** @internal */\r\n public planeInteractions: ISurfaceConstraintInteraction[];\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverActivePlanes {\r\n /** @internal */\r\n public index: number;\r\n /** @internal */\r\n public constraint: ISurfaceConstraintInfo;\r\n /** @internal */\r\n public interaction: ISurfaceConstraintInteraction;\r\n\r\n /** @internal */\r\n public copyFrom(other: SimplexSolverActivePlanes) {\r\n this.index = other.index;\r\n this.constraint = other.constraint;\r\n this.interaction = other.interaction;\r\n }\r\n}\r\n\r\n/** @internal */\r\nclass SimplexSolverInfo {\r\n /** @internal */\r\n public supportPlanes: Array<SimplexSolverActivePlanes> = new Array<SimplexSolverActivePlanes>(4);\r\n /** @internal */\r\n public numSupportPlanes: number = 0;\r\n /** @internal */\r\n public currentTime: number = 0;\r\n /** @internal */\r\n public inputConstraints: ISurfaceConstraintInfo[];\r\n /** @internal */\r\n public outputInteractions: ISurfaceConstraintInteraction[];\r\n /** @internal */\r\n public getOutput(constraint: ISurfaceConstraintInfo): ISurfaceConstraintInteraction {\r\n return this.outputInteractions[this.inputConstraints.indexOf(constraint)]; //<todo.eoin This is O(1) in C++! Equivalent in TS?\r\n }\r\n}\r\n\r\n/** @internal */\r\nfunction ContactFromCast(hp: HavokPlugin, cp: any /*ContactPoint*/, castPath: Vector3, hitFraction: number, keepDistance: number): IContact {\r\n const bodyMap = (hp as any)._bodies;\r\n\r\n const normal = Vector3.FromArray(cp[4]);\r\n const dist = -hitFraction * castPath.dot(normal);\r\n return {\r\n position: Vector3.FromArray(cp[3]),\r\n normal: normal,\r\n distance: dist,\r\n fraction: hitFraction,\r\n bodyB: bodyMap.get(cp[0][0])!,\r\n allowedPenetration: Math.min(Math.max(keepDistance - dist, 0.0), keepDistance),\r\n };\r\n}\r\n\r\n/**\r\n * Character controller using physics\r\n */\r\nexport class PhysicsCharacterController {\r\n private _position: Vector3;\r\n private _orientation: Quaternion = Quaternion.Identity();\r\n private _velocity: Vector3;\r\n private _lastVelocity: Vector3;\r\n private _shape: PhysicsShape;\r\n private _body: PhysicsBody;\r\n private _transformNode: TransformNode;\r\n private _ownShape: boolean;\r\n private _manifold: IContact[] = [];\r\n private _lastDisplacement: Vector3;\r\n private _contactAngleSensitivity = 10.0;\r\n private _lastInvDeltaTime: number;\r\n private _scene: Scene;\r\n private _tmpMatrix = new Matrix();\r\n private _tmpVecs: Vector3[] = BuildArray(32, Vector3.Zero);\r\n\r\n /**\r\n * minimum distance to make contact\r\n * default 0.05\r\n */\r\n public keepDistance: number = 0.05;\r\n /**\r\n * maximum distance to keep contact\r\n * default 0.1\r\n */\r\n public keepContactTolerance: number = 0.1;\r\n /**\r\n * maximum number of raycast per integration starp\r\n * default 10\r\n */\r\n public maxCastIterations: number = 10;\r\n /**\r\n * speed when recovery from penetration\r\n * default 1.0\r\n */\r\n public penetrationRecoverySpeed = 1.0;\r\n /**\r\n * friction with static surfaces\r\n * default 0\r\n */\r\n public staticFriction = 0;\r\n /**\r\n * friction with dynamic surfaces\r\n * default 1\r\n */\r\n public dynamicFriction = 1;\r\n /**\r\n * cosine value of slope angle that can be climbed\r\n * computed as `Math.cos(Math.PI * (angleInDegree / 180.0));`\r\n * default 0.5 (value for a 60deg angle)\r\n */\r\n public maxSlopeCosine = 0.5;\r\n /**\r\n * character maximum speed\r\n * default 10\r\n */\r\n public maxCharacterSpeedForSolver = 10.0;\r\n /**\r\n * up vector\r\n */\r\n public up = new Vector3(0, 1, 0);\r\n /**\r\n * Strength when pushing other bodies\r\n * default 1e38\r\n */\r\n public characterStrength = 1e38;\r\n\r\n /**\r\n * Acceleration factor. A value of 1 means reaching max velocity immediately\r\n */\r\n public acceleration = 0.05;\r\n\r\n /**\r\n * maximum acceleration in world space coordinate\r\n */\r\n public maxAcceleration = 50;\r\n\r\n /**\r\n * character mass\r\n * default 0\r\n */\r\n public characterMass = 0;\r\n\r\n /**\r\n * Observable for trigger entered and trigger exited events\r\n */\r\n public onTriggerCollisionObservable = new Observable<ICharacterControllerCollisionEvent>();\r\n\r\n private _startCollector;\r\n private _castCollector;\r\n\r\n // If the difference between the cast displacement and the simplex solver output position is less than this\r\n // value (per component), do not do a second cast to check if it's possible to reach the output position.\r\n private _displacementEps = 1e-4;\r\n\r\n /**\r\n * instanciate a new characterController\r\n * @param position Initial position\r\n * @param characterShapeOptions character physics shape options\r\n * @param scene Scene\r\n */\r\n public constructor(position: Vector3, characterShapeOptions: CharacterShapeOptions, scene: Scene) {\r\n this._position = position.clone();\r\n this._velocity = Vector3.Zero();\r\n this._lastVelocity = Vector3.Zero();\r\n const r = characterShapeOptions.capsuleRadius ?? 0.6;\r\n const h = characterShapeOptions.capsuleHeight ?? 1.8;\r\n this._tmpVecs[0].set(0, h * 0.5 - r, 0);\r\n this._tmpVecs[1].set(0, -h * 0.5 + r, 0);\r\n this._ownShape = !characterShapeOptions.shape;\r\n this._shape = characterShapeOptions.shape ?? new PhysicsShapeCapsule(this._tmpVecs[0], this._tmpVecs[1], r, scene);\r\n this._transformNode = new TransformNode(\"CCTransformNode\", scene);\r\n this._transformNode.position.copyFrom(this._position);\r\n this._body = new PhysicsBody(this._transformNode, PhysicsMotionType.ANIMATED, false, scene);\r\n this._body.setMassProperties({ inertia: Vector3.ZeroReadOnly });\r\n this._body.shape = this._shape;\r\n this._body.disablePreStep = false;\r\n this._lastInvDeltaTime = 1.0 / 60.0;\r\n this._lastDisplacement = Vector3.Zero();\r\n this._scene = scene;\r\n\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n this._startCollector = hknp.HP_QueryCollector_Create(16)[1];\r\n this._castCollector = hknp.HP_QueryCollector_Create(16)[1];\r\n }\r\n\r\n /**\r\n * Dispose the character controller\r\n */\r\n public dispose() {\r\n if (this._ownShape) {\r\n this._shape.dispose();\r\n }\r\n this._body.dispose();\r\n this._transformNode.dispose();\r\n\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n hknp.HP_QueryCollector_Release(this._startCollector);\r\n hknp.HP_QueryCollector_Release(this._castCollector);\r\n }\r\n\r\n /**\r\n * Get shape used for collision\r\n */\r\n public get shape() {\r\n return this._shape;\r\n }\r\n\r\n /**\r\n * Set shape used for collision\r\n */\r\n public set shape(value: PhysicsShape) {\r\n this._body.shape = this._shape;\r\n if (this._ownShape) {\r\n this._shape.dispose();\r\n }\r\n this._shape = value;\r\n this._ownShape = false;\r\n }\r\n\r\n /**\r\n * Character position\r\n * @returns Character position\r\n */\r\n public getPosition(): Vector3 {\r\n return this._position;\r\n }\r\n\r\n /**\r\n * Teleport character to a new position\r\n * @param position new position\r\n */\r\n public setPosition(position: Vector3) {\r\n this._position.copyFrom(position);\r\n this._transformNode.position.copyFrom(this._position);\r\n }\r\n\r\n /**\r\n * Character velocity\r\n * @returns Character velocity vector\r\n */\r\n public getVelocity(): Vector3 {\r\n return this._velocity;\r\n }\r\n\r\n /**\r\n * Set velocity vector\r\n * @param velocity vector\r\n */\r\n public setVelocity(velocity: Vector3) {\r\n this._velocity.copyFrom(velocity);\r\n }\r\n\r\n protected _validateManifold() {\r\n const newManifold = [];\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n if (!this._manifold[i].bodyB.body.isDisposed) {\r\n newManifold.push(this._manifold[i]);\r\n }\r\n }\r\n this._manifold = newManifold;\r\n }\r\n\r\n private _getPointVelocityToRef(body: { body: PhysicsBody; index: number }, pointWorld: Vector3, result: Vector3) {\r\n //<todo does this really not exist in body interface?\r\n const comWorld = this._tmpVecs[10];\r\n this._getComWorldToRef(body, comWorld);\r\n const relPos = this._tmpVecs[11];\r\n pointWorld.subtractToRef(comWorld, relPos);\r\n const av = this._tmpVecs[12];\r\n body.body.getAngularVelocityToRef(av, body.index);\r\n const arm = this._tmpVecs[13];\r\n Vector3.CrossToRef(av, relPos, arm);\r\n arm.addToRef(body.body.getLinearVelocity(body.index), result);\r\n }\r\n\r\n protected _compareContacts(contactA: IContact, contactB: IContact): number {\r\n const angSquared = (1.0 - contactA.normal.dot(contactB.normal)) * this._contactAngleSensitivity * this._contactAngleSensitivity;\r\n const planeDistSquared = (contactA.distance - contactB.distance) * (contactA.distance * contactB.distance);\r\n\r\n const p1Vel = this._tmpVecs[7];\r\n this._getPointVelocityToRef(contactA.bodyB, contactA.position, p1Vel);\r\n const p2Vel = this._tmpVecs[8];\r\n this._getPointVelocityToRef(contactB.bodyB, contactB.position, p2Vel);\r\n const velocityDiff = this._tmpVecs[9];\r\n p1Vel.subtractToRef(p2Vel, velocityDiff);\r\n const velocityDiffSquared = velocityDiff.lengthSquared();\r\n\r\n const fitness = angSquared * 10.0 + velocityDiffSquared * 0.1 + planeDistSquared;\r\n return fitness;\r\n }\r\n\r\n protected _findContact(referenceContact: IContact, contactList: IContact[], threshold: number) {\r\n let bestIdx = -1;\r\n let bestFitness = threshold;\r\n for (let i = 0; i < contactList.length; i++) {\r\n const fitness = this._compareContacts(referenceContact, contactList[i]);\r\n if (fitness < bestFitness) {\r\n bestFitness = fitness;\r\n bestIdx = i;\r\n }\r\n }\r\n return bestIdx;\r\n }\r\n\r\n protected _updateManifold(startCollector: any /*HP_CollectorId*/, castCollector: any /*HP_CollectorId*/, castPath: Vector3): number {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n const numProximityHits = hknp.HP_QueryCollector_GetNumHits(startCollector)[1];\r\n if (numProximityHits > 0) {\r\n const newContacts = [];\r\n let minDistance = 1e38;\r\n const bodyMap = (<any>hk)._bodies;\r\n for (let i = 0; i < numProximityHits; i++) {\r\n const [distance, , contactWorld] = hknp.HP_QueryCollector_GetShapeProximityResult(startCollector, i)[1];\r\n minDistance = Math.min(minDistance, distance);\r\n newContacts.push({\r\n position: Vector3.FromArray(contactWorld[3]),\r\n normal: Vector3.FromArray(contactWorld[4]),\r\n distance: distance,\r\n fraction: 0,\r\n bodyB: bodyMap.get(contactWorld[0][0])!,\r\n allowedPenetration: Math.min(Math.max(this.keepDistance - distance, 0.0), this.keepDistance),\r\n });\r\n }\r\n\r\n for (let i = this._manifold.length - 1; i >= 0; i--) {\r\n const currentContact = this._manifold[i];\r\n const bestMatch = this._findContact(currentContact, newContacts, 1.1);\r\n if (bestMatch >= 0) {\r\n const newAllowedPenetration = Math.min(Math.max(this.keepDistance - newContacts[bestMatch].distance, 0.0), currentContact.allowedPenetration);\r\n this._manifold[i] = newContacts[bestMatch];\r\n this._manifold[i].allowedPenetration = newAllowedPenetration;\r\n newContacts.splice(bestMatch, 1);\r\n } else {\r\n this._manifold.splice(i, 1);\r\n }\r\n }\r\n\r\n const closestContactIndex = newContacts.findIndex((c) => c.distance == minDistance);\r\n if (closestContactIndex >= 0) {\r\n const bestMatch = this._findContact(newContacts[closestContactIndex], this._manifold, 0.1);\r\n if (bestMatch >= 0) {\r\n const newAllowedPenetration = Math.min(\r\n Math.max(this.keepDistance - newContacts[closestContactIndex].distance, 0.0),\r\n this._manifold[bestMatch].allowedPenetration\r\n );\r\n this._manifold[bestMatch] = newContacts[closestContactIndex];\r\n this._manifold[bestMatch].allowedPenetration = newAllowedPenetration;\r\n } else {\r\n this._manifold.push(newContacts[closestContactIndex]);\r\n }\r\n }\r\n } else {\r\n // No start hits; clear manifold completely\r\n this._manifold.length = 0;\r\n }\r\n\r\n let numHitBodies = 0; //< == CASTCOLLECTOR_HIT_SINGLE_BODY\r\n // Process shape cast results if any\r\n const numCastHits = hknp.HP_QueryCollector_GetNumHits(castCollector)[1];\r\n if (numCastHits > 0) {\r\n let closestHitBody = null;\r\n for (let i = 0; i < numCastHits; i++) {\r\n const [fraction, , hitWorld] = hknp.HP_QueryCollector_GetShapeCastResult(castCollector, i)[1];\r\n if (closestHitBody == null) {\r\n const contact = ContactFromCast(hk, hitWorld, castPath, fraction, this.keepDistance);\r\n closestHitBody = hitWorld[0][0];\r\n const bestMatch = this._findContact(contact, this._manifold, 0.1);\r\n if (bestMatch == -1) {\r\n this._manifold.push(contact);\r\n }\r\n\r\n if (contact.bodyB.body.getMotionType(contact.bodyB.index) == PhysicsMotionType.STATIC) {\r\n // The closest body is static, so it cannot move away from CC and we don't need to look any further.\r\n break;\r\n }\r\n } else if (closestHitBody._pluginData && hitWorld[0] != closestHitBody._pluginData.hpBodyId) {\r\n numHitBodies++;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Remove from the manifold contacts that are too similar as the simplex does not handle parallel planes\r\n for (let e1 = this._manifold.length - 1; e1 >= 0; e1--) {\r\n let e2 = e1 - 1;\r\n for (; e2 >= 0; e2--) {\r\n const fitness = this._compareContacts(this._manifold[e1], this._manifold[e2]);\r\n if (fitness < 0.1) {\r\n break;\r\n }\r\n }\r\n if (e2 >= 0) {\r\n this._manifold.slice(e1, 1);\r\n }\r\n }\r\n\r\n return numHitBodies;\r\n }\r\n\r\n // Store previous positions per body for velocity calculation\r\n protected _bodyPositionTracking = new Map();\r\n\r\n protected _createSurfaceConstraint(dt: number, contact: IContact, timeTravelled: number): ISurfaceConstraintInfo {\r\n const constraint = {\r\n //let distance = contact.distance - this.keepDistance;\r\n planeNormal: contact.normal.clone(),\r\n planeDistance: contact.distance,\r\n staticFriction: this.staticFriction,\r\n dynamicFriction: this.dynamicFriction,\r\n extraUpStaticFriction: 0,\r\n extraDownStaticFriction: 0,\r\n velocity: Vector3.Zero(),\r\n angularVelocity: Vector3.Zero(),\r\n priority: 0,\r\n };\r\n\r\n const maxSlopeCosEps = 0.1;\r\n const maxSlopeCosine = Math.max(this.maxSlopeCosine, maxSlopeCosEps);\r\n const normalDotUp = contact.normal.dot(this.up);\r\n\r\n const contactPosition = contact.position.clone();\r\n if (normalDotUp > maxSlopeCosine) {\r\n const com = this.getPosition();\r\n const contactArm = this._tmpVecs[20];\r\n contact.position.subtractToRef(com, contactArm);\r\n const scale = contact.normal.dot(contactArm);\r\n contactPosition.x = com.x + this.up.x * scale;\r\n contactPosition.y = com.y + this.up.y * scale;\r\n contactPosition.z = com.z + this.up.z * scale;\r\n }\r\n\r\n const motionType = contact.bodyB.body.getMotionType(contact.bodyB.index);\r\n if (motionType != PhysicsMotionType.STATIC) {\r\n //<todo Need hknpMotionUtil::predictPontVelocity\r\n }\r\n\r\n const shift = constraint.velocity.dot(constraint.planeNormal) * timeTravelled;\r\n constraint.planeDistance -= shift;\r\n\r\n if (motionType == PhysicsMotionType.STATIC) {\r\n constraint.priority = 2;\r\n } else if (motionType == PhysicsMotionType.ANIMATED) {\r\n const bodyTransformNode = contact.bodyB.body.transformNode;\r\n const bodyId = bodyTransformNode.uniqueId;\r\n\r\n // Retrieve tracking data\r\n let tracking = this._bodyPositionTracking.get(bodyId);\r\n\r\n const currentFrameWorldMatrix = contact.bodyB.body.transformNode.getWorldMatrix();\r\n const frameId = this._scene.getFrameId();\r\n\r\n if (!tracking) {\r\n // Initialize tracking\r\n tracking = {\r\n prevWorldMatrix: currentFrameWorldMatrix.clone(),\r\n frameId: frameId,\r\n };\r\n this._bodyPositionTracking.set(bodyId, tracking);\r\n } else {\r\n // Only calculate velocity if this contact existed in the previous frame\r\n // This avoids huge delta spikes when first making contact or after gaps\r\n if (tracking.frameId + 1 === frameId) {\r\n const previousFrameWorldMatrix = tracking.prevWorldMatrix;\r\n\r\n const currentFrameWorldMatrixInverse = TmpVectors.Matrix[1];\r\n\r\n currentFrameWorldMatrix.invertToRef(currentFrameWorldMatrixInverse);\r\n\r\n const characterPosition = this.getPosition();\r\n // compute characterPosition in body local space at previous frame\r\n const characterLocalPosition = this._tmpVecs[21];\r\n Vector3.TransformCoordinatesToRef(characterPosition, currentFrameWorldMatrixInverse, characterLocalPosition);\r\n\r\n const characterWorldPosition = this._tmpVecs[22];\r\n Vector3.TransformCoordinatesToRef(characterLocalPosition, previousFrameWorldMatrix, characterWorldPosition);\r\n const playerDeltaPosition = this._tmpVecs[23];\r\n characterPosition.subtractToRef(characterWorldPosition, playerDeltaPosition);\r\n\r\n constraint.velocity.copyFrom(playerDeltaPosition);\r\n constraint.velocity.scaleInPlace(1 / dt);\r\n constraint.priority = 1;\r\n }\r\n tracking.prevWorldMatrix.copyFrom(currentFrameWorldMatrix);\r\n tracking.frameId = frameId;\r\n }\r\n }\r\n\r\n return constraint;\r\n }\r\n\r\n protected _addMaxSlopePlane(maxSlopeCos: number, up: Vector3, index: number, constraints: ISurfaceConstraintInfo[], allowedPenetration: number): boolean {\r\n const verticalComponent = constraints[index].planeNormal.dot(up);\r\n if (verticalComponent > 0.01 && verticalComponent < maxSlopeCos) {\r\n const newConstraint = {\r\n planeNormal: constraints[index].planeNormal.clone(),\r\n planeDistance: constraints[index].planeDistance,\r\n velocity: constraints[index].velocity.clone(),\r\n angularVelocity: constraints[index].angularVelocity.clone(),\r\n priority: constraints[index].priority,\r\n dynamicFriction: constraints[index].dynamicFriction,\r\n staticFriction: constraints[index].staticFriction,\r\n extraDownStaticFriction: constraints[index].extraDownStaticFriction,\r\n extraUpStaticFriction: constraints[index].extraUpStaticFriction,\r\n };\r\n const distance = newConstraint.planeDistance;\r\n newConstraint.planeNormal.subtractInPlace(up.scale(verticalComponent));\r\n newConstraint.planeNormal.normalize();\r\n if (distance >= 0) {\r\n newConstraint.planeDistance = distance * newConstraint.planeNormal.dot(constraints[index].planeNormal);\r\n } else {\r\n const penetrationToResolve = Math.min(0, distance + allowedPenetration);\r\n newConstraint.planeDistance = penetrationToResolve / newConstraint.planeNormal.dot(constraints[index].planeNormal);\r\n constraints[index].planeDistance = 0;\r\n this._resolveConstraintPenetration(newConstraint, this.penetrationRecoverySpeed);\r\n }\r\n constraints.push(newConstraint);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n protected _resolveConstraintPenetration(constraint: ISurfaceConstraintInfo, penetrationRecoverySpeed: number) {\r\n // If penetrating we add extra velocity to push the character back out\r\n const eps = 1e-6;\r\n if (constraint.planeDistance < -eps) {\r\n constraint.planeNormal.scaleToRef(constraint.planeDistance * penetrationRecoverySpeed, this._tmpVecs[6]);\r\n constraint.velocity.subtractInPlace(this._tmpVecs[6]);\r\n }\r\n }\r\n\r\n protected _createConstraintsFromManifold(dt: number, timeTravelled: number): ISurfaceConstraintInfo[] {\r\n const constraints = [];\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const surfaceConstraint = this._createSurfaceConstraint(dt, this._manifold[i], timeTravelled);\r\n constraints.push(surfaceConstraint);\r\n this._addMaxSlopePlane(this.maxSlopeCosine, this.up, i, constraints, this._manifold[i].allowedPenetration);\r\n this._resolveConstraintPenetration(surfaceConstraint, this.penetrationRecoverySpeed);\r\n }\r\n return constraints;\r\n }\r\n\r\n protected _simplexSolverSortInfo(info: SimplexSolverInfo) {\r\n // simple bubble sort by (priority,velocity)\r\n for (let i = 0; i < info.numSupportPlanes - 1; i++) {\r\n for (let j = i + 1; j < info.numSupportPlanes; j++) {\r\n const p0 = info.supportPlanes[i];\r\n const p1 = info.supportPlanes[j];\r\n if (p0.constraint.priority < p1.constraint.priority) {\r\n continue;\r\n }\r\n if (p0.constraint.priority == p1.constraint.priority) {\r\n const vel0 = p0.constraint.velocity.lengthSquared();\r\n const vel1 = p1.constraint.velocity.lengthSquared();\r\n if (vel0 < vel1) {\r\n continue;\r\n }\r\n }\r\n info.supportPlanes[i] = p1;\r\n info.supportPlanes[j] = p0;\r\n }\r\n }\r\n }\r\n\r\n protected _simplexSolverSolve1d(info: SimplexSolverInfo, sci: ISurfaceConstraintInfo, velocityIn: Vector3, velocityOut: Vector3) {\r\n const eps = 1e-5;\r\n const groundVelocity = sci.velocity;\r\n const relativeVelocity = this._tmpVecs[22];\r\n velocityIn.subtractToRef(groundVelocity, relativeVelocity);\r\n\r\n const planeVel = relativeVelocity.dot(sci.planeNormal);\r\n\r\n const origVelocity2 = relativeVelocity.lengthSquared();\r\n relativeVelocity.subtractInPlace(sci.planeNormal.scale(planeVel));\r\n {\r\n const vp2 = planeVel * planeVel;\r\n // static friction is active if\r\n // velProjPlane * friction > |(velParallel)|\r\n // vplane * f > vpar\r\n // vp * f > vpar\r\n // vp2 * f2 > vpar2\r\n const extraStaticFriction = relativeVelocity.dot(this.up) > 0 ? sci.extraUpStaticFriction : sci.extraDownStaticFriction;\r\n if (extraStaticFriction > 0) {\r\n const horizontal = this.up.cross(sci.planeNormal);\r\n const hor2 = horizontal.lengthSquared();\r\n let horVel = 0.0;\r\n if (hor2 > eps) {\r\n horizontal.scaleInPlace(1 / Math.sqrt(hor2));\r\n\r\n horVel = relativeVelocity.dot(horizontal);\r\n\r\n // horizontal component\r\n {\r\n const horVel2 = horVel * horVel;\r\n const f2 = sci.staticFriction * sci.staticFriction;\r\n if (vp2 * f2 >= horVel2) {\r\n relativeVelocity.subtractInPlace(horizontal.scale(horVel));\r\n horVel = 0;\r\n }\r\n }\r\n }\r\n\r\n // vert component\r\n {\r\n const vertVel2 = origVelocity2 - horVel * horVel - vp2;\r\n const f2 = (sci.staticFriction + extraStaticFriction) * (sci.staticFriction + extraStaticFriction);\r\n if (vp2 * f2 >= vertVel2) {\r\n if (horVel == 0.0) {\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n }\r\n }\r\n } else {\r\n // static friction is active if\r\n // velProjPlane * friction > |(vel-velProjPlane)|\r\n // vp * f > rvProj\r\n //\r\n // -> vp * f >= rvProj\r\n // -> vp * f >= sqrt( vel^2 - vp^2 )\r\n // -> vp^2 ( f^2 + 1 ) >= vel^2\r\n const f2 = sci.staticFriction * sci.staticFriction;\r\n if (vp2 * (1 + f2) >= origVelocity2) {\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n }\r\n }\r\n\r\n if (sci.dynamicFriction < 1) {\r\n // apply dynamic friction 0 = conserve input velocity 1 = clip against normal\r\n const velOut2 = relativeVelocity.lengthSquared();\r\n if (velOut2 >= eps) {\r\n if (velOut2 > 1e-4 * origVelocity2) {\r\n let f = Math.sqrt(origVelocity2 / velOut2);\r\n f = sci.dynamicFriction + (1 - sci.dynamicFriction) * f;\r\n relativeVelocity.scaleInPlace(f);\r\n const p = sci.planeNormal.dot(relativeVelocity);\r\n relativeVelocity.subtractInPlace(sci.planeNormal.scale(p));\r\n }\r\n }\r\n }\r\n velocityOut.copyFrom(relativeVelocity);\r\n velocityOut.addInPlace(groundVelocity);\r\n }\r\n\r\n protected _simplexSolverSolveTest1d(sci: ISurfaceConstraintInfo, velocityIn: Vector3): boolean {\r\n const eps = 1e-3;\r\n const relativeVelocity = this._tmpVecs[23];\r\n velocityIn.subtractToRef(sci.velocity, relativeVelocity);\r\n return relativeVelocity.dot(sci.planeNormal) < -eps;\r\n }\r\n\r\n protected _simplexSolverSolve2d(\r\n info: SimplexSolverInfo,\r\n maxSurfaceVelocity: Vector3,\r\n sci0: ISurfaceConstraintInfo,\r\n sci1: ISurfaceConstraintInfo,\r\n velocityIn: Vector3,\r\n velocityOut: Vector3\r\n ) {\r\n const eps = 1e-5;\r\n const axis = sci0.planeNormal.cross(sci1.planeNormal);\r\n const axisLen2 = axis.lengthSquared();\r\n\r\n let solveSequentially = false;\r\n let axisVel = null;\r\n\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n // Check for parallel planes\r\n if (axisLen2 <= eps || solveSequentially) {\r\n info.getOutput(sci0).status = SurfaceConstraintInteractionStatus.FAILURE_2D;\r\n info.getOutput(sci1).status = SurfaceConstraintInteractionStatus.FAILURE_2D;\r\n\r\n if (sci0.priority > sci1.priority) {\r\n this._simplexSolverSolve1d(info, sci1, velocityIn, velocityOut);\r\n this._simplexSolverSolve1d(info, sci0, velocityIn, velocityOut);\r\n } else {\r\n this._simplexSolverSolve1d(info, sci0, velocityIn, velocityOut);\r\n this._simplexSolverSolve1d(info, sci1, velocityIn, velocityOut);\r\n }\r\n return;\r\n }\r\n\r\n const invAxisLen = 1.0 / Math.sqrt(axisLen2);\r\n axis.scaleInPlace(invAxisLen);\r\n\r\n // Calculate the velocity of the free axis\r\n {\r\n const r0 = sci0.planeNormal.cross(sci1.planeNormal);\r\n const r1 = sci1.planeNormal.cross(axis);\r\n const r2 = axis.cross(sci0.planeNormal);\r\n\r\n const sVel = sci0.velocity.add(sci1.velocity);\r\n\r\n const t = this._tmpVecs[2];\r\n t.set(0.5 * axis.dot(sVel), sci0.planeNormal.dot(sci0.velocity), sci1.planeNormal.dot(sci1.velocity));\r\n const m = Matrix.FromValues(r0.x, r1.x, r2.x, 0, r0.y, r1.y, r2.y, 0, r0.z, r1.z, r2.z, 0, 0, 0, 0, 1);\r\n axisVel = Vector3.TransformNormal(t, m);\r\n axisVel.scaleInPlace(invAxisLen);\r\n\r\n if (Math.abs(axisVel.x) > maxSurfaceVelocity.x || Math.abs(axisVel.y) > maxSurfaceVelocity.y || Math.abs(axisVel.z) > maxSurfaceVelocity.z) {\r\n solveSequentially = true;\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const groundVelocity = axisVel;\r\n const relativeVelocity = this._tmpVecs[24];\r\n velocityIn.subtractToRef(groundVelocity, relativeVelocity);\r\n\r\n const vel2 = relativeVelocity.lengthSquared();\r\n const axisVert = this.up.dot(axis);\r\n let axisProjVelocity = relativeVelocity.dot(axis);\r\n\r\n let staticFriction = sci0.staticFriction + sci1.staticFriction;\r\n if (axisVert * axisProjVelocity > 0) {\r\n staticFriction += (sci0.extraUpStaticFriction + sci1.extraUpStaticFriction) * axisVert;\r\n } else {\r\n staticFriction += (sci0.extraDownStaticFriction + sci1.extraDownStaticFriction) * axisVert;\r\n }\r\n staticFriction *= 0.5;\r\n\r\n const dynamicFriction = (sci0.dynamicFriction + sci1.dynamicFriction) * 0.5;\r\n // static friction is active if\r\n // |vel-axisProjVelocity|(rv) * friction(f) > axisProjVelocity(av)\r\n // -> sqrt( vel2 - av2 ) * f > av\r\n // -> (vel2 - av2) * f2 > av2\r\n const f2 = staticFriction * staticFriction;\r\n const av2 = axisProjVelocity * axisProjVelocity;\r\n if ((vel2 - av2) * f2 >= av2) {\r\n // static friction kicks in\r\n velocityOut.copyFrom(groundVelocity);\r\n return;\r\n }\r\n\r\n if (dynamicFriction < 1) {\r\n // apply dynamic friction\r\n if (axisProjVelocity * axisProjVelocity > 1e-4 * vel2) {\r\n const tmp = 1.0 / axisProjVelocity;\r\n const f = Math.abs(tmp) * Math.sqrt(vel2) * (1.0 - dynamicFriction) + dynamicFriction;\r\n axisProjVelocity *= f;\r\n }\r\n }\r\n velocityOut.copyFrom(groundVelocity);\r\n velocityOut.addInPlace(axis.scale(axisProjVelocity));\r\n }\r\n\r\n protected _simplexSolverSolve3d(\r\n info: SimplexSolverInfo,\r\n maxSurfaceVelocity: Vector3,\r\n sci0: ISurfaceConstraintInfo,\r\n sci1: ISurfaceConstraintInfo,\r\n sci2: ISurfaceConstraintInfo,\r\n allowResort: boolean,\r\n velocityIn: Vector3,\r\n velocityOut: Vector3\r\n ) {\r\n const eps = 1e-5;\r\n // Calculate the velocity of the point axis\r\n let pointVel = null;\r\n {\r\n const r0 = sci1.planeNormal.cross(sci2.planeNormal);\r\n const r1 = sci2.planeNormal.cross(sci0.planeNormal);\r\n const r2 = sci0.planeNormal.cross(sci1.planeNormal);\r\n\r\n const det = r0.dot(sci0.planeNormal);\r\n let solveSequentially = false;\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n if (Math.abs(det) < eps || solveSequentially) {\r\n if (allowResort) {\r\n this._simplexSolverSortInfo(info);\r\n sci0 = info.supportPlanes[0].constraint;\r\n sci1 = info.supportPlanes[1].constraint;\r\n sci2 = info.supportPlanes[2].constraint;\r\n }\r\n info.getOutput(sci0).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n info.getOutput(sci1).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n info.getOutput(sci2).status = SurfaceConstraintInteractionStatus.FAILURE_3D;\r\n\r\n const oldNum = info.numSupportPlanes;\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci0, sci1, velocityIn, velocityOut);\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci0, sci2, velocityIn, velocityOut);\r\n }\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, sci1, sci2, velocityIn, velocityOut);\r\n }\r\n\r\n return;\r\n }\r\n\r\n const t = this._tmpVecs[2];\r\n t.set(sci0.planeNormal.dot(sci0.velocity), sci1.planeNormal.dot(sci1.velocity), sci2.planeNormal.dot(sci2.velocity));\r\n const m = Matrix.FromValues(r0.x, r0.y, r0.z, 0, r1.x, r1.y, r1.z, 0, r2.x, r2.y, r2.z, 0, 0, 0, 0, 1);\r\n pointVel = Vector3.TransformNormal(t, m);\r\n pointVel.scaleInPlace(1 / det);\r\n if (Math.abs(pointVel.x) > maxSurfaceVelocity.x || Math.abs(pointVel.y) > maxSurfaceVelocity.y || Math.abs(pointVel.z) > maxSurfaceVelocity.z) {\r\n solveSequentially = true;\r\n } else {\r\n break;\r\n }\r\n }\r\n }\r\n velocityOut.copyFrom(pointVel);\r\n }\r\n\r\n protected _simplexSolverExamineActivePlanes(info: SimplexSolverInfo, maxSurfaceVelocity: Vector3, velocityIn: Vector3, velocityOut: Vector3) {\r\n // eslint-disable-next-line no-constant-condition\r\n while (true) {\r\n switch (info.numSupportPlanes) {\r\n case 1: {\r\n const sci = info.supportPlanes[0].constraint;\r\n this._simplexSolverSolve1d(info, sci, velocityIn, velocityOut);\r\n return;\r\n }\r\n case 2: {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve1d(info, info.supportPlanes[1].constraint, velocityIn, velocity);\r\n const plane0Used = this._simplexSolverSolveTest1d(info.supportPlanes[0].constraint, velocity);\r\n if (!plane0Used) {\r\n // Only need plane 1, so remove plane 0\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[1]);\r\n info.numSupportPlanes = 1;\r\n velocityOut.copyFrom(velocity);\r\n } else {\r\n this._simplexSolverSolve2d(info, maxSurfaceVelocity, info.supportPlanes[0].constraint, info.supportPlanes[1].constraint, velocityIn, velocityOut);\r\n }\r\n return;\r\n }\r\n case 3: {\r\n // Try to drop both planes\r\n {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve1d(info, info.supportPlanes[2].constraint, velocityIn, velocityOut);\r\n\r\n const plane0Used = this._simplexSolverSolveTest1d(info.supportPlanes[0].constraint, velocity);\r\n if (!plane0Used) {\r\n const plane1Used = this._simplexSolverSolveTest1d(info.supportPlanes[1].constraint, velocity);\r\n if (!plane1Used) {\r\n velocityOut.copyFrom(velocity);\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[2]);\r\n info.numSupportPlanes = 1;\r\n continue;\r\n }\r\n }\r\n }\r\n\r\n // Try to drop plane 0 or 1\r\n {\r\n let droppedAPlane = false;\r\n for (let testPlane = 0; testPlane < 2; testPlane++) {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve2d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[testPlane].constraint,\r\n info.supportPlanes[2].constraint,\r\n velocityIn,\r\n velocityOut\r\n );\r\n const planeUsed = this._simplexSolverSolveTest1d(info.supportPlanes[1 - testPlane].constraint, velocity);\r\n if (!planeUsed) {\r\n info.supportPlanes[0].copyFrom(info.supportPlanes[testPlane]);\r\n info.supportPlanes[1].copyFrom(info.supportPlanes[2]);\r\n info.numSupportPlanes--;\r\n droppedAPlane = true;\r\n break;\r\n }\r\n }\r\n\r\n if (droppedAPlane) {\r\n continue;\r\n }\r\n }\r\n\r\n // Otherwise, try and solve all three planes:\r\n this._simplexSolverSolve3d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[0].constraint,\r\n info.supportPlanes[1].constraint,\r\n info.supportPlanes[2].constraint,\r\n true,\r\n velocityIn,\r\n velocityOut\r\n );\r\n return;\r\n }\r\n case 4: {\r\n this._simplexSolverSortInfo(info);\r\n let droppedAPlane = false;\r\n\r\n for (let i = 0; i < 3; i++) {\r\n const velocity = Vector3.Zero();\r\n this._simplexSolverSolve3d(\r\n info,\r\n maxSurfaceVelocity,\r\n info.supportPlanes[(i + 1) % 3].constraint,\r\n info.supportPlanes[(i + 2) % 3].constraint,\r\n info.supportPlanes[3].constraint,\r\n false,\r\n velocityIn,\r\n velocity\r\n );\r\n const planeUsed = this._simplexSolverSolveTest1d(info.supportPlanes[i].constraint, velocity);\r\n if (!planeUsed) {\r\n info.supportPlanes[i].copyFrom(info.supportPlanes[2]);\r\n info.supportPlanes[2].copyFrom(info.supportPlanes[3]);\r\n info.numSupportPlanes = 3;\r\n droppedAPlane = true;\r\n break;\r\n }\r\n }\r\n\r\n if (droppedAPlane) {\r\n continue;\r\n }\r\n\r\n // Nothing can be dropped so we've failed to solve\r\n // Now we try all 3d combinations\r\n {\r\n const velocity = velocityIn.clone();\r\n const sci0 = info.supportPlanes[0].constraint;\r\n const sci1 = info.supportPlanes[1].constraint;\r\n const sci2 = info.supportPlanes[2].constraint;\r\n const sci3 = info.supportPlanes[3].constraint;\r\n const oldNum = info.numSupportPlanes;\r\n if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci1, sci2, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci1, sci3, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci0, sci2, sci3, false, velocity, velocity);\r\n // eslint-disable-next-line no-dupe-else-if\r\n } else if (oldNum == info.numSupportPlanes) {\r\n this._simplexSolverSolve3d(info, maxSurfaceVelocity, sci1, sci2, sci3, false, velocity, velocity);\r\n }\r\n\r\n velocityOut.copyFrom(velocity);\r\n }\r\n\r\n // Search a plane to drop\r\n {\r\n // Search the highest penalty value\r\n let maxStatus = SurfaceConstraintInteractionStatus.OK;\r\n for (let i = 0; i < 4; i++) {\r\n maxStatus = Math.max(maxStatus, info.supportPlanes[i].interaction.status);\r\n }\r\n\r\n // Remove the place with the lowest priority and the highest penalty\r\n let i = 0;\r\n for (; i < 4; i++) {\r\n if (maxStatus == info.supportPlanes[i].interaction.status) {\r\n info.supportPlanes[i].copyFrom(info.supportPlanes[3]);\r\n break;\r\n }\r\n info.numSupportPlanes--;\r\n }\r\n }\r\n\r\n // Clear penalty flags for the other planes\r\n for (let i = 0; i < 3; i++) {\r\n info.supportPlanes[i].interaction.status = SurfaceConstraintInteractionStatus.OK;\r\n }\r\n\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _simplexSolverSolve(\r\n constraints: ISurfaceConstraintInfo[],\r\n velocity: Vector3,\r\n deltaTime: number,\r\n minDeltaTime: number,\r\n up: Vector3,\r\n maxSurfaceVelocity: Vector3\r\n ): SimplexSolverOutput {\r\n const eps = 1e-6;\r\n const output = new SimplexSolverOutput();\r\n output.position = Vector3.Zero();\r\n output.velocity = velocity.clone();\r\n output.planeInteractions = [];\r\n let remainingTime = deltaTime;\r\n\r\n for (let i = 0; i < constraints.length; i++) {\r\n output.planeInteractions.push({\r\n touched: false,\r\n stopped: false,\r\n surfaceTime: 0,\r\n penaltyDistance: 0,\r\n status: SurfaceConstraintInteractionStatus.OK,\r\n });\r\n }\r\n\r\n const info = new SimplexSolverInfo();\r\n info.inputConstraints = constraints;\r\n info.outputInteractions = output.planeInteractions;\r\n info.supportPlanes[0] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[1] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[2] = new SimplexSolverActivePlanes();\r\n info.supportPlanes[3] = new SimplexSolverActivePlanes();\r\n\r\n while (remainingTime > 0) {\r\n // search for a plane which collides our current direction\r\n let hitIndex = -1;\r\n let minCollisionTime = remainingTime;\r\n for (let i = 0; i < constraints.length; i++) {\r\n // Do not search existing active planes\r\n if (info.numSupportPlanes >= 1 && info.supportPlanes[0].index == i) {\r\n continue;\r\n }\r\n if (info.numSupportPlanes >= 2 && info.supportPlanes[1].index == i) {\r\n continue;\r\n }\r\n if (info.numSupportPlanes >= 3 && info.supportPlanes[2].index == i) {\r\n continue;\r\n }\r\n if (output.planeInteractions[i].status != SurfaceConstraintInteractionStatus.OK) {\r\n continue;\r\n }\r\n\r\n // Try to find the plane with the shortest time to move\r\n const sci = constraints[i];\r\n const relativeVel = this._tmpVecs[25];\r\n output.velocity.subtractToRef(sci.velocity, relativeVel);\r\n const relativeProjectedVel = -relativeVel.dot(sci.planeNormal);\r\n // if projected velocity is pointing away skip it\r\n if (relativeProjectedVel <= 0) {\r\n continue;\r\n }\r\n\r\n // Calculate the time of impact\r\n const relativePos = this._tmpVecs[26];\r\n sci.velocity.scaleToRef(info.currentTime, this._tmpVecs[27]);\r\n output.position.subtractToRef(this._tmpVecs[27], relativePos);\r\n let projectedPos = sci.planeNormal.dot(relativePos);\r\n\r\n // treat penetrations\r\n const penaltyDist = output.planeInteractions[i].penaltyDistance;\r\n if (penaltyDist < eps) {\r\n projectedPos = 0;\r\n }\r\n projectedPos += penaltyDist;\r\n\r\n // check for new hit\r\n if (projectedPos < minCollisionTime * relativeProjectedVel) {\r\n minCollisionTime = projectedPos / relativeProjectedVel;\r\n hitIndex = i;\r\n }\r\n }\r\n\r\n // integrate: Walk to our hitPosition we must walk more than 10 microseconds into the future to consider it valid.\r\n const minAcceptableCollisionTime = 1e-4;\r\n if (minCollisionTime > minAcceptableCollisionTime) {\r\n info.currentTime += minCollisionTime;\r\n remainingTime -= minCollisionTime;\r\n output.position.addInPlace(output.velocity.scale(minCollisionTime));\r\n for (let i = 0; i < info.numSupportPlanes; i++) {\r\n info.supportPlanes[i].interaction.surfaceTime += minCollisionTime;\r\n info.supportPlanes[i].interaction.touched = true;\r\n }\r\n\r\n output.deltaTime = info.currentTime;\r\n if (info.currentTime > minDeltaTime) {\r\n return output;\r\n }\r\n }\r\n\r\n // If we have no hit than we are done\r\n if (hitIndex < 0) {\r\n output.deltaTime = deltaTime;\r\n break;\r\n }\r\n\r\n // Add our hit to our current list of active planes\r\n const supportPlane = info.supportPlanes[info.numSupportPlanes++];\r\n supportPlane.constraint = constraints[hitIndex];\r\n supportPlane.interaction = output.planeInteractions[hitIndex];\r\n supportPlane.interaction.penaltyDistance = (supportPlane.interaction.penaltyDistance + eps) * 2.0;\r\n supportPlane.index = hitIndex;\r\n\r\n // Move our character along the current set of active planes\r\n this._simplexSolverExamineActivePlanes(info, maxSurfaceVelocity, velocity, output.velocity);\r\n }\r\n\r\n return output;\r\n }\r\n\r\n /**\r\n * Compute a CharacterSurfaceInfo from current state and a direction\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param direction direction to check, usually gravity direction\r\n * @returns a CharacterSurfaceInfo object\r\n */\r\n public checkSupport(deltaTime: number, direction: Vector3): CharacterSurfaceInfo {\r\n const surfaceInfo = {\r\n isSurfaceDynamic: false,\r\n supportedState: CharacterSupportedState.UNSUPPORTED,\r\n averageSurfaceNormal: Vector3.Zero(),\r\n averageSurfaceVelocity: Vector3.Zero(),\r\n averageAngularSurfaceVelocity: Vector3.Zero(),\r\n };\r\n this.checkSupportToRef(deltaTime, direction, surfaceInfo);\r\n return surfaceInfo;\r\n }\r\n\r\n /**\r\n * Compute a CharacterSurfaceInfo from current state and a direction\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param direction direction to check, usually gravity direction\r\n * @param surfaceInfo output for surface info\r\n */\r\n public checkSupportToRef(deltaTime: number, direction: Vector3, surfaceInfo: CharacterSurfaceInfo): void {\r\n const eps = 1e-4;\r\n\r\n this._validateManifold();\r\n const constraints = this._createConstraintsFromManifold(deltaTime, 0.0);\r\n const storedVelocities: Vector3[] = [];\r\n // Remove velocities and friction to make this a query of the static geometry\r\n for (let i = 0; i < constraints.length; i++) {\r\n storedVelocities.push(constraints[i].velocity.clone());\r\n constraints[i].velocity.setAll(0);\r\n }\r\n\r\n const maxSurfaceVelocity = this._tmpVecs[3];\r\n maxSurfaceVelocity.set(this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver);\r\n const output = this._simplexSolverSolve(constraints, direction, deltaTime, deltaTime, this.up, maxSurfaceVelocity);\r\n\r\n surfaceInfo.averageSurfaceVelocity.setAll(0);\r\n surfaceInfo.averageAngularSurfaceVelocity.setAll(0);\r\n surfaceInfo.averageSurfaceNormal.setAll(0);\r\n surfaceInfo.isSurfaceDynamic = false;\r\n\r\n // If the constraints did not affect the character movement then it is unsupported and we can finish\r\n if (output.velocity.equalsWithEpsilon(direction, eps)) {\r\n surfaceInfo.supportedState = CharacterSupportedState.UNSUPPORTED;\r\n return;\r\n }\r\n\r\n // Check how was the input velocity modified to determine if the character is supported or sliding\r\n if (output.velocity.lengthSquared() < eps) {\r\n surfaceInfo.supportedState = CharacterSupportedState.SUPPORTED;\r\n } else {\r\n output.velocity.normalize();\r\n const angleSin = output.velocity.dot(direction);\r\n const cosSqr = 1 - angleSin * angleSin;\r\n if (cosSqr < this.maxSlopeCosine * this.maxSlopeCosine) {\r\n surfaceInfo.supportedState = CharacterSupportedState.SLIDING;\r\n } else {\r\n surfaceInfo.supportedState = CharacterSupportedState.SUPPORTED;\r\n }\r\n }\r\n\r\n // Add all supporting constraints to the ground information\r\n let numTouching = 0;\r\n for (let i = -0; i < constraints.length; i++) {\r\n if (output.planeInteractions[i].touched && constraints[i].planeNormal.dot(direction) < -0.08) {\r\n surfaceInfo.averageSurfaceNormal.addInPlace(constraints[i].planeNormal);\r\n surfaceInfo.averageSurfaceVelocity.addInPlace(storedVelocities[i]);\r\n surfaceInfo.averageAngularSurfaceVelocity.addInPlace(constraints[i].angularVelocity);\r\n numTouching++;\r\n }\r\n }\r\n\r\n if (numTouching > 0) {\r\n surfaceInfo.averageSurfaceNormal.normalize();\r\n surfaceInfo.averageSurfaceVelocity.scaleInPlace(1 / numTouching);\r\n surfaceInfo.averageAngularSurfaceVelocity.scaleInPlace(1 / numTouching);\r\n }\r\n\r\n // isSurfaceDynamic update\r\n if (surfaceInfo.supportedState == CharacterSupportedState.SUPPORTED) {\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const manifold = this._manifold[i];\r\n const bodyB = manifold.bodyB;\r\n\r\n if (this._manifold[i].normal.dot(direction) < -0.08 && bodyB.body.getMotionType(0) == PhysicsMotionType.DYNAMIC) {\r\n surfaceInfo.isSurfaceDynamic = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _castWithCollectors(startPos: Vector3, endPos: Vector3, castCollector: any /*HP_CollectorId*/, startCollector?: any /*HP_CollectorId*/) {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const hknp = hk._hknp;\r\n\r\n const startNative = [startPos.x, startPos.y, startPos.z];\r\n const orientation = [this._orientation.x, this._orientation.y, this._orientation.z, this._orientation.w];\r\n if (startCollector != null) {\r\n const query /*: ShapeProximityInput*/ = [\r\n this._shape._pluginData,\r\n startNative,\r\n orientation,\r\n this.keepDistance + this.keepContactTolerance, // max distance\r\n false, // should hit triggers\r\n [this._body._pluginData.hpBodyId[0]],\r\n ];\r\n hknp.HP_World_ShapeProximityWithCollector(hk.world, startCollector, query);\r\n }\r\n\r\n {\r\n const query /*: ShapeCastInput*/ = [\r\n this._shape._pluginData,\r\n orientation,\r\n startNative,\r\n [endPos.x, endPos.y, endPos.z],\r\n false, // should hit triggers\r\n [this._body._pluginData.hpBodyId[0]],\r\n ];\r\n hknp.HP_World_ShapeCastWithCollector(hk.world, castCollector, query);\r\n }\r\n }\r\n\r\n protected _resolveContacts(deltaTime: number, gravity: Vector3) {\r\n const eps = 1e-12;\r\n //<todo object interactions out\r\n for (let i = 0; i < this._manifold.length; i++) {\r\n const contact = this._manifold[i];\r\n const bodyB = this._manifold[i].bodyB;\r\n\r\n //<todo test if bodyB is another character with a proxy body\r\n\r\n // Skip fixed or keyframed bodies as we won't apply impulses to them\r\n if (bodyB.body.getMotionType(bodyB.index) != PhysicsMotionType.DYNAMIC) {\r\n continue;\r\n }\r\n\r\n // Calculate and apply impulse on contacted body\r\n {\r\n //<todo input/output for callbacks\r\n let inputObjectMassInv = 0;\r\n let inputObjectImpulse = 0;\r\n let outputObjectImpulse = Vector3.Zero();\r\n const outputImpulsePosition = contact.position;\r\n\r\n // Calculate relative normal velocity of the contact point in the contacted body\r\n const pointRelVel = this._tmpVecs[19];\r\n this._getPointVelocityToRef(bodyB, contact.position, pointRelVel);\r\n pointRelVel.subtractInPlace(this._velocity);\r\n const inputProjectedVelocity = pointRelVel.dot(contact.normal);\r\n const dampFactor = 0.9;\r\n\r\n // Change velocity\r\n let deltaVelocity = -inputProjectedVelocity * dampFactor;\r\n\r\n // Apply an extra impulse if the collision is actually penetrating\r\n if (contact.distance < 0) {\r\n const recoveryTau = 0.4;\r\n deltaVelocity += (contact.distance * recoveryTau) / deltaTime;\r\n }\r\n\r\n // Apply impulse if required to keep bodies apart\r\n if (deltaVelocity < 0) {\r\n // Calculate the impulse magnitude\r\n const invInertia = this._getInverseInertiaWorld(bodyB);\r\n const comWorld = this._tmpVecs[15];\r\n this._getComWorldToRef(bodyB, comWorld);\r\n const r = this._tmpVecs[16];\r\n contact.position.subtractToRef(comWorld, r);\r\n const jacAng = this._tmpVecs[17];\r\n Vector3.CrossToRef(r, contact.normal, jacAng);\r\n const rc = this._tmpVecs[18];\r\n Vector3.TransformNormalToRef(jacAng, invInertia, rc);\r\n inputObjectMassInv = rc.dot(jacAng) + this._getInvMass(bodyB);\r\n inputObjectImpulse = deltaVelocity / inputObjectMassInv;\r\n\r\n // Clamp impulse magnitude if required and apply it to the normal direction\r\n const maxPushImpulse = -this.characterStrength * deltaTime;\r\n if (inputObjectImpulse < maxPushImpulse) {\r\n inputObjectImpulse = maxPushImpulse;\r\n }\r\n outputObjectImpulse = contact.normal.scale(inputObjectImpulse);\r\n } else {\r\n inputObjectImpulse = 0;\r\n inputObjectMassInv = this._getInvMass(bodyB);\r\n }\r\n\r\n // Add gravity\r\n {\r\n // Calculate effect of gravity on the velocity of the character in the contact normal direction\r\n let relVelN = contact.normal.dot(gravity.scale(deltaTime));\r\n // If it is a separating contact subtract the separation velocity\r\n if (inputProjectedVelocity < 0) {\r\n relVelN -= inputProjectedVelocity;\r\n }\r\n // If the resulting velocity is negative an impulse is applied to stop the character from falling into\r\n // the contacted body\r\n if (relVelN < -eps) {\r\n outputObjectImpulse.addInPlace(contact.normal.scale(this.characterMass * relVelN));\r\n }\r\n }\r\n\r\n //<todo Fire callback to allow user to change impulse + use the info / play sounds\r\n\r\n const triggerCollisionInfo: ICharacterControllerCollisionEvent = {\r\n collider: bodyB.body,\r\n colliderIndex: bodyB.index,\r\n impulse: outputObjectImpulse,\r\n impulsePosition: outputImpulsePosition,\r\n };\r\n this.onTriggerCollisionObservable.notifyObservers(triggerCollisionInfo);\r\n\r\n bodyB.body.applyImpulse(outputObjectImpulse, outputImpulsePosition, bodyB.index);\r\n }\r\n }\r\n }\r\n\r\n protected _getInverseInertiaWorld(body: { body: PhysicsBody; index: number }): DeepImmutableObject<Matrix> {\r\n const mp = body.body.getMassProperties(body.index);\r\n if (!mp.inertia || !mp.inertiaOrientation) {\r\n return Matrix.IdentityReadOnly;\r\n }\r\n const invOrientation = Matrix.FromQuaternionToRef(mp.inertiaOrientation, TmpVectors.Matrix[0]).invert();\r\n const it = TmpVectors.Matrix[1];\r\n\r\n const ir = invOrientation.getRowToRef(0, TmpVectors.Vector4[0]);\r\n it.setRowFromFloats(0, mp.inertia.x * ir.x, mp.inertia.x * ir.y, mp.inertia.x * ir.z, 0);\r\n invOrientation.getRowToRef(1, ir);\r\n it.setRowFromFloats(0, mp.inertia.y * ir.x, mp.inertia.y * ir.y, mp.inertia.y * ir.z, 0);\r\n invOrientation.getRowToRef(2, ir);\r\n it.setRowFromFloats(0, mp.inertia.z * ir.x, mp.inertia.z * ir.y, mp.inertia.z * ir.z, 0);\r\n invOrientation.multiplyToRef(it, this._tmpMatrix);\r\n return this._tmpMatrix;\r\n }\r\n\r\n protected _getComWorldToRef(body: { body: PhysicsBody; index: number }, result: Vector3) {\r\n const mp = body.body.getMassProperties(body.index);\r\n Vector3.TransformCoordinatesToRef(mp.centerOfMass!, body.body.transformNode.getWorldMatrix(), result);\r\n }\r\n\r\n protected _getInvMass(body: { body: PhysicsBody; index: number }): number {\r\n return 1 / body.body.getMassProperties(body.index).mass!;\r\n }\r\n\r\n protected _integrateManifolds(deltaTime: number, gravity: Vector3): void {\r\n const hk = this._scene.getPhysicsEngine()!.getPhysicsPlugin() as HavokPlugin;\r\n const epsSqrd = 1e-8;\r\n\r\n let newVelocity = Vector3.Zero();\r\n let remainingTime = deltaTime;\r\n\r\n // Make sure that contact with bodies that have been removed since the call to checkSupport() are removed from the\r\n // manifold\r\n this._validateManifold();\r\n\r\n for (let iter = 0; iter < this.maxCastIterations && remainingTime > 1e-5; iter++) {\r\n this._castWithCollectors(this._position, this._position.add(this._lastDisplacement), this._castCollector, this._startCollector);\r\n const updateResult = this._updateManifold(this._startCollector, this._castCollector, this._lastDisplacement);\r\n\r\n // Create surface constraints from the manifold contacts.\r\n const constraints = this._createConstraintsFromManifold(deltaTime, deltaTime - remainingTime);\r\n const maxSurfaceVelocity = this._tmpVecs[3];\r\n maxSurfaceVelocity.set(this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver, this.maxCharacterSpeedForSolver);\r\n const minDeltaTime = this._velocity.lengthSquared() == 0 ? 0.0 : (0.5 * this.keepDistance) / this._velocity.length();\r\n const solveResults = this._simplexSolverSolve(constraints, this._velocity, remainingTime, minDeltaTime, this.up, maxSurfaceVelocity);\r\n const newDisplacement = solveResults.position;\r\n const solverDeltaTime = solveResults.deltaTime;\r\n newVelocity = solveResults.velocity;\r\n\r\n this._resolveContacts(deltaTime, gravity);\r\n\r\n let newContactIndex = -1;\r\n // todo if (updateResult == hit multiple bodies) ... cast again\r\n\r\n // If castCollector had hits on different bodies (so we're not sure if some non-closest body could be in our way) OR\r\n // the simplex has given an output direction different from the cast guess\r\n // we re-cast to check we can move there. There is no need to get the start points again.\r\n if (updateResult != 0 || (newDisplacement.lengthSquared() > epsSqrd && !this._lastDisplacement.equalsWithEpsilon(newDisplacement, this._displacementEps))) {\r\n this._castWithCollectors(this._position, this._position.add(newDisplacement), this._castCollector, this._startCollector);\r\n const hknp = hk._hknp;\r\n const numCastHits = hknp.HP_QueryCollector_GetNumHits(this._castCollector)[1];\r\n // Find the first contact that isn't already in the manifold\r\n if (numCastHits > 0) {\r\n //<todo sortHits()\r\n for (let i = 0; i < numCastHits; i++) {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const [fraction, _hitLocal, hitWorld] = hknp.HP_QueryCollector_GetShapeCastResult(this._castCollector, i)[1];\r\n const newContact = ContactFromCast(hk, hitWorld, newDisplacement, fraction, this.keepDistance);\r\n if (this._findContact(newContact, this._manifold, 0.1) == -1) {\r\n //<todo fireContactAdded\r\n newContactIndex = this._manifold.length;\r\n this._manifold.push(newContact);\r\n //<todo updateTriggersSeen()\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (newContactIndex >= 0) {\r\n const newContact = this._manifold[newContactIndex];\r\n const displacementLengthInv = 1.0 / newDisplacement.length();\r\n const angleBetweenMovementAndSurface = newDisplacement.dot(newContact.normal) * displacementLengthInv;\r\n const keepDistanceAlongMovement = this.keepDistance / -angleBetweenMovementAndSurface;\r\n const distance = newContact.fraction;\r\n let fraction = distance - keepDistanceAlongMovement * displacementLengthInv;\r\n fraction = Math.min(Math.max(fraction, 0.0), 1.0);\r\n\r\n const displacement = newDisplacement.scale(fraction);\r\n this._position.addInPlace(displacement);\r\n remainingTime -= solverDeltaTime * fraction;\r\n } else {\r\n this._position.addInPlace(newDisplacement);\r\n remainingTime -= solverDeltaTime;\r\n }\r\n this._lastDisplacement.copyFrom(newDisplacement);\r\n }\r\n\r\n this._velocity.copyFrom(newVelocity);\r\n this._transformNode.position.copyFrom(this._position);\r\n }\r\n\r\n /**\r\n * Move the character with collisions\r\n * @param displacement defines the requested displacement vector\r\n */\r\n public moveWithCollisions(displacement: Vector3): void {\r\n if (this._scene.deltaTime == undefined) {\r\n return;\r\n }\r\n const deltaTime = this._scene.deltaTime / 1000.0;\r\n const invDeltaTime = 1 / deltaTime;\r\n\r\n displacement.scaleToRef(1 / deltaTime, this._velocity);\r\n this._lastDisplacement.copyFrom(displacement);\r\n\r\n this._lastVelocity.copyFrom(this._velocity);\r\n this._lastInvDeltaTime = invDeltaTime;\r\n\r\n this._integrateManifolds(deltaTime, Vector3.ZeroReadOnly);\r\n }\r\n\r\n /**\r\n * Update internal state. Must be called once per frame\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param surfaceInfo surface information returned by checkSupport\r\n * @param gravity gravity applied to the character. Can be different that world gravity\r\n */\r\n public integrate(deltaTime: number, surfaceInfo: CharacterSurfaceInfo, gravity: Vector3) {\r\n const invDeltaTime = 1 / deltaTime;\r\n const remainingTime = deltaTime;\r\n\r\n // Choose the first cast direction. If velocity hasn't changed from the previous integrate, guess that the\r\n // displacement will be the same as last integrate, scaled by relative step length. Otherwise, guess based\r\n // on current velocity.\r\n {\r\n const tolerance = this._displacementEps * invDeltaTime;\r\n if (this._velocity.equalsWithEpsilon(this._lastVelocity, tolerance)) {\r\n this._lastDisplacement.scaleInPlace(remainingTime * this._lastInvDeltaTime);\r\n } else {\r\n const displacementVelocity = this._velocity;\r\n if (surfaceInfo.supportedState == CharacterSupportedState.SUPPORTED) {\r\n const relativeVelocity = this._tmpVecs[28];\r\n this._velocity.subtractToRef(surfaceInfo.averageSurfaceVelocity, relativeVelocity);\r\n const normalDotVelocity = surfaceInfo.averageSurfaceNormal.dot(relativeVelocity);\r\n if (normalDotVelocity < 0) {\r\n relativeVelocity.subtractInPlace(surfaceInfo.averageSurfaceNormal.scale(normalDotVelocity));\r\n displacementVelocity.copyFrom(relativeVelocity);\r\n displacementVelocity.addInPlace(surfaceInfo.averageSurfaceVelocity);\r\n }\r\n }\r\n this._lastDisplacement.copyFrom(displacementVelocity);\r\n this._lastDisplacement.scaleInPlace(remainingTime);\r\n }\r\n this._lastVelocity.copyFrom(this._velocity);\r\n this._lastInvDeltaTime = invDeltaTime;\r\n }\r\n\r\n this._integrateManifolds(deltaTime, gravity);\r\n }\r\n\r\n /**\r\n * Helper function to calculate velocity based on surface informations and current velocity state and target\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param forwardWorld character forward in world coordinates\r\n * @param surfaceNormal surface normal direction\r\n * @param currentVelocity current velocity\r\n * @param surfaceVelocity velocity induced by the surface\r\n * @param desiredVelocity desired character velocity\r\n * @param upWorld up vector in world space\r\n * @param result resulting velocity vector\r\n * @returns boolean true if result has been computed\r\n */\r\n public calculateMovementToRef(\r\n deltaTime: number,\r\n forwardWorld: Vector3,\r\n surfaceNormal: Vector3,\r\n currentVelocity: Vector3,\r\n surfaceVelocity: Vector3,\r\n desiredVelocity: Vector3,\r\n upWorld: Vector3,\r\n result: Vector3\r\n ): boolean {\r\n const eps = 1e-5;\r\n let binorm = forwardWorld.cross(upWorld);\r\n if (binorm.lengthSquared() < eps) {\r\n return false;\r\n }\r\n binorm.normalize();\r\n const tangent = binorm.cross(surfaceNormal);\r\n tangent.normalize();\r\n binorm = tangent.cross(surfaceNormal);\r\n binorm.normalize();\r\n\r\n const surfaceFrame = Matrix.FromValues(\r\n tangent.x,\r\n tangent.y,\r\n tangent.z,\r\n 0,\r\n binorm.x,\r\n binorm.y,\r\n binorm.z,\r\n 0,\r\n surfaceNormal.x,\r\n surfaceNormal.y,\r\n surfaceNormal.z,\r\n 0,\r\n 0,\r\n 0,\r\n 0,\r\n 1\r\n );\r\n const invSurfaceFrame = surfaceFrame.clone().invert();\r\n\r\n currentVelocity.subtractToRef(surfaceVelocity, this._tmpVecs[29]);\r\n const relative = this._tmpVecs[30];\r\n Vector3.TransformNormalToRef(this._tmpVecs[29], invSurfaceFrame, relative);\r\n\r\n const sideVec = upWorld.cross(forwardWorld);\r\n const fwd = desiredVelocity.dot(forwardWorld);\r\n const side = desiredVelocity.dot(sideVec);\r\n const len = desiredVelocity.length();\r\n\r\n const desiredVelocitySF = this._tmpVecs[4];\r\n desiredVelocitySF.set(-fwd, side, 0);\r\n desiredVelocitySF.normalize();\r\n desiredVelocitySF.scaleInPlace(len);\r\n const diff = this._tmpVecs[5];\r\n desiredVelocitySF.subtractToRef(relative, diff);\r\n\r\n // Clamp it by maxAcceleration and limit it by gain.\r\n {\r\n const lenSq = diff.lengthSquared();\r\n const maxVelocityDelta = this.maxAcceleration * deltaTime;\r\n let tmp: number;\r\n if (lenSq * this.acceleration * this.acceleration > maxVelocityDelta * maxVelocityDelta) {\r\n tmp = maxVelocityDelta / Math.sqrt(lenSq);\r\n } else {\r\n tmp = this.acceleration;\r\n }\r\n diff.scaleInPlace(tmp);\r\n }\r\n\r\n relative.addInPlace(diff);\r\n\r\n // Transform back to world space and apply\r\n Vector3.TransformNormalToRef(relative, surfaceFrame, result);\r\n\r\n // Add back in the surface velocity\r\n result.addInPlace(surfaceVelocity);\r\n return true;\r\n }\r\n\r\n /**\r\n * Helper function to calculate velocity based on surface informations and current velocity state and target\r\n * @param deltaTime frame delta time in seconds. When using scene.deltaTime divide by 1000.0\r\n * @param forwardWorld character forward in world coordinates\r\n * @param surfaceNormal surface normal direction\r\n * @param currentVelocity current velocity\r\n * @param surfaceVelocity velocity induced by the surface\r\n * @param desiredVelocity desired character velocity\r\n * @param upWorld up vector in world space\r\n * @returns a new velocity vector\r\n */\r\n public calculateMovement(\r\n deltaTime: number,\r\n forwardWorld: Vector3,\r\n surfaceNormal: Vector3,\r\n currentVelocity: Vector3,\r\n surfaceVelocity: Vector3,\r\n desiredVelocity: Vector3,\r\n upWorld: Vector3\r\n ): Vector3 {\r\n const result = new Vector3(0, 0, 0);\r\n this.calculateMovementToRef(deltaTime, forwardWorld, surfaceNormal, currentVelocity, surfaceVelocity, desiredVelocity, upWorld, result);\r\n return result;\r\n }\r\n}\r\n"]}
|