├── .editorconfig ├── .gitattributes ├── .gitignore ├── AsyncLineTraceSample.uproject ├── Config ├── DefaultEditor.ini ├── DefaultEngine.ini ├── DefaultGame.ini └── DefaultInput.ini ├── Content ├── B_AsyncLineTracer.uasset ├── M_Sphere.uasset ├── Test.umap └── W_Panel.uasset ├── Platforms └── HoloLens │ └── Config │ └── HoloLensEngine.ini ├── README.md └── Source ├── AsyncLineTraceSample.Target.cs ├── AsyncLineTraceSample ├── AsyncLineTraceSample.Build.cs ├── AsyncLineTraceSample.cpp ├── AsyncLineTraceSample.h ├── AsyncLineTraceSampleGameModeBase.cpp ├── AsyncLineTraceSampleGameModeBase.h ├── AsyncTraceActor.cpp └── AsyncTraceActor.h └── AsyncLineTraceSampleEditor.Target.cs /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | [*] 3 | indent_style = space 4 | indent_size = 4 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | end_of_line = ctlf 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | #from https://historia.co.jp/archives/12245/ 2 | *.uasset filter=lfs diff=lfs merge=lfs -text 3 | *.umap filter=lfs diff=lfs merge=lfs -text 4 | *.bmp filter=lfs diff=lfs merge=lfs -text 5 | *.float filter=lfs diff=lfs merge=lfs -text 6 | *.pcx filter=lfs diff=lfs merge=lfs -text 7 | *.png filter=lfs diff=lfs merge=lfs -text 8 | *.psd filter=lfs diff=lfs merge=lfs -text 9 | *.tga filter=lfs diff=lfs merge=lfs -text 10 | *.jpg filter=lfs diff=lfs merge=lfs -text 11 | *.exr filter=lfs diff=lfs merge=lfs -text 12 | *.dds filter=lfs diff=lfs merge=lfs -text 13 | *.hdr filter=lfs diff=lfs merge=lfs -text 14 | *.wav filter=lfs diff=lfs merge=lfs -text 15 | *.mp4 filter=lfs diff=lfs merge=lfs -text 16 | *.obj filter=lfs diff=lfs merge=lfs -text 17 | *.fbx filter=lfs diff=lfs merge=lfs -text 18 | *.zip filter=lfs diff=lfs merge=lfs -text 19 | *.xlsx filter=lfs diff=lfs merge=lfs -text 20 | *.docx filter=lfs diff=lfs merge=lfs -text 21 | *.pptx filter=lfs diff=lfs merge=lfs -text 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # from https://github.com/github/gitignore/blob/master/UnrealEngine.gitignore 2 | 3 | # Visual Studio 2015 user specific files 4 | .vs/ 5 | 6 | # Compiled Object files 7 | *.slo 8 | *.lo 9 | *.o 10 | *.obj 11 | 12 | # Precompiled Headers 13 | *.gch 14 | *.pch 15 | 16 | # Compiled Dynamic libraries 17 | *.so 18 | *.dylib 19 | *.dll 20 | 21 | # Fortran module files 22 | *.mod 23 | 24 | # Compiled Static libraries 25 | *.lai 26 | *.la 27 | *.a 28 | *.lib 29 | 30 | # Executables 31 | *.exe 32 | *.out 33 | *.app 34 | *.ipa 35 | 36 | # These project files can be generated by the engine 37 | *.xcodeproj 38 | *.xcworkspace 39 | *.sln 40 | *.suo 41 | *.opensdf 42 | *.sdf 43 | *.VC.db 44 | *.VC.opendb 45 | .vsconfig 46 | 47 | # Precompiled Assets 48 | SourceArt/**/*.png 49 | SourceArt/**/*.tga 50 | 51 | # Binary Files 52 | Binaries/* 53 | Plugins/*/Binaries/* 54 | 55 | # Builds 56 | Build/* 57 | 58 | # Whitelist PakBlacklist-.txt files 59 | !Build/*/ 60 | Build/*/** 61 | !Build/*/PakBlacklist*.txt 62 | 63 | # Don't ignore icon files in Build 64 | !Build/**/*.ico 65 | 66 | # Built data for maps 67 | *_BuiltData.uasset 68 | 69 | # Configuration files generated by the Editor 70 | Saved/* 71 | 72 | # Compiled source files for the engine to use 73 | Intermediate/* 74 | Plugins/*/Intermediate/* 75 | 76 | # Cache files for the editor to use 77 | DerivedDataCache/* 78 | 79 | # StarterContent 80 | Content/StarterContent/* 81 | 82 | # Build Image 83 | Image/* -------------------------------------------------------------------------------- /AsyncLineTraceSample.uproject: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "EngineAssociation": "5.5", 4 | "Category": "", 5 | "Description": "", 6 | "Modules": [ 7 | { 8 | "Name": "AsyncLineTraceSample", 9 | "Type": "Runtime", 10 | "LoadingPhase": "Default", 11 | "AdditionalDependencies": [ 12 | "Engine" 13 | ] 14 | } 15 | ], 16 | "Plugins": [ 17 | { 18 | "Name": "ModelingToolsEditorMode", 19 | "Enabled": true, 20 | "TargetAllowList": [ 21 | "Editor" 22 | ] 23 | }, 24 | { 25 | "Name": "OpenImageDenoise", 26 | "Enabled": false 27 | } 28 | ] 29 | } -------------------------------------------------------------------------------- /Config/DefaultEditor.ini: -------------------------------------------------------------------------------- 1 | [/Script/AdvancedPreviewScene.SharedProfiles] 2 | 3 | -------------------------------------------------------------------------------- /Config/DefaultEngine.ini: -------------------------------------------------------------------------------- 1 | 2 | 3 | [/Script/EngineSettings.GameMapsSettings] 4 | GameDefaultMap=/Game/Test.Test 5 | EditorStartupMap=/Game/Test.Test 6 | 7 | [/Script/WindowsTargetPlatform.WindowsTargetSettings] 8 | DefaultGraphicsRHI=DefaultGraphicsRHI_DX12 9 | -D3D12TargetedShaderFormats=PCD3D_SM5 10 | +D3D12TargetedShaderFormats=PCD3D_SM6 11 | -D3D11TargetedShaderFormats=PCD3D_SM5 12 | +D3D11TargetedShaderFormats=PCD3D_SM5 13 | Compiler=Default 14 | AudioSampleRate=48000 15 | AudioCallbackBufferFrameSize=1024 16 | AudioNumBuffersToEnqueue=1 17 | AudioMaxChannels=0 18 | AudioNumSourceWorkers=4 19 | SpatializationPlugin= 20 | SourceDataOverridePlugin= 21 | ReverbPlugin= 22 | OcclusionPlugin= 23 | CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0) 24 | CacheSizeKB=65536 25 | MaxChunkSizeOverrideKB=0 26 | bResampleForDevice=False 27 | MaxSampleRate=48000.000000 28 | HighSampleRate=32000.000000 29 | MedSampleRate=24000.000000 30 | LowSampleRate=12000.000000 31 | MinSampleRate=8000.000000 32 | CompressionQualityModifier=1.000000 33 | AutoStreamingThreshold=0.000000 34 | SoundCueCookQualityIndex=-1 35 | 36 | [/Script/HardwareTargeting.HardwareTargetingSettings] 37 | TargetedHardwareClass=Desktop 38 | AppliedTargetedHardwareClass=Desktop 39 | DefaultGraphicsPerformance=Maximum 40 | AppliedDefaultGraphicsPerformance=Maximum 41 | 42 | [/Script/Engine.RendererSettings] 43 | r.GenerateMeshDistanceFields=True 44 | r.DynamicGlobalIlluminationMethod=1 45 | r.ReflectionMethod=1 46 | r.Shadow.Virtual.Enable=1 47 | r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True 48 | 49 | [/Script/WorldPartitionEditor.WorldPartitionEditorSettings] 50 | CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet' 51 | 52 | [/Script/Engine.Engine] 53 | +ActiveGameNameRedirects=(OldGameName="TP_Blank",NewGameName="/Script/AsyncLineTraceSample") 54 | +ActiveGameNameRedirects=(OldGameName="/Script/TP_Blank",NewGameName="/Script/AsyncLineTraceSample") 55 | +ActiveClassRedirects=(OldClassName="TP_BlankGameModeBase",NewClassName="AsyncLineTraceSampleGameModeBase") 56 | 57 | [/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings] 58 | bEnablePlugin=True 59 | bAllowNetworkConnection=True 60 | SecurityToken=757195B6492350F10A21BCB8A88A219C 61 | bIncludeInShipping=False 62 | bAllowExternalStartInShipping=False 63 | bCompileAFSProject=False 64 | bUseCompression=False 65 | bLogFiles=False 66 | bReportStats=False 67 | ConnectionType=USBOnly 68 | bUseManualIPAddress=False 69 | ManualIPAddress= 70 | 71 | -------------------------------------------------------------------------------- /Config/DefaultGame.ini: -------------------------------------------------------------------------------- 1 | 2 | [/Script/EngineSettings.GeneralProjectSettings] 3 | ProjectID=32DF679140AF9F91F13E41ADACEB5BB0 4 | -------------------------------------------------------------------------------- /Config/DefaultInput.ini: -------------------------------------------------------------------------------- 1 | [/Script/Engine.InputSettings] 2 | -AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 3 | -AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 4 | -AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 5 | -AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 6 | -AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) 7 | -AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) 8 | -AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) 9 | +AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 10 | +AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 11 | +AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 12 | +AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 13 | +AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) 14 | +AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) 15 | +AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) 16 | +AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 17 | +AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 18 | +AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 19 | +AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 20 | +AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 21 | +AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 22 | +AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 23 | +AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 24 | +AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 25 | +AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 26 | +AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 27 | +AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 28 | +AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 29 | +AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 30 | +AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 31 | +AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 32 | +AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 33 | +AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 34 | +AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 35 | +AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 36 | +AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 37 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 38 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 39 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 40 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 41 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 42 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 43 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 44 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 45 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 46 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 47 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 48 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 49 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 50 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 51 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 52 | +AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 53 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 54 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 55 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 56 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 57 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 58 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 59 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 60 | +AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 61 | bAltEnterTogglesFullscreen=True 62 | bF11TogglesFullscreen=True 63 | bUseMouseForTouch=False 64 | bEnableMouseSmoothing=True 65 | bEnableFOVScaling=True 66 | bCaptureMouseOnLaunch=True 67 | bEnableLegacyInputScales=True 68 | bEnableMotionControls=True 69 | bFilterInputByPlatformUser=False 70 | bShouldFlushPressedKeysOnViewportFocusLost=True 71 | bEnableDynamicComponentInputBinding=True 72 | bAlwaysShowTouchInterface=False 73 | bShowConsoleOnFourFingerTap=True 74 | bEnableGestureRecognizer=False 75 | bUseAutocorrect=False 76 | DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown 77 | DefaultViewportMouseLockMode=LockOnCapture 78 | FOVScale=0.011110 79 | DoubleClickTime=0.200000 80 | DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput 81 | DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent 82 | DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks 83 | -ConsoleKeys=Tilde 84 | +ConsoleKeys=@ 85 | +ConsoleKeys=Caret 86 | 87 | -------------------------------------------------------------------------------- /Content/B_AsyncLineTracer.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:bc2aa5554b9c30bb3ae2d4f45269d86cd22f2dfe4449f684a648df7d8c0114ff 3 | size 188889 4 | -------------------------------------------------------------------------------- /Content/M_Sphere.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:2b7c6c8259a830479f26d4920593ea0123f2017044772739e5139e96660fc8b3 3 | size 8641 4 | -------------------------------------------------------------------------------- /Content/Test.umap: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:9194c336540c598b926c622d6a406f7bd6259e9485914dda7ae4acb0563f9aa2 3 | size 80837 4 | -------------------------------------------------------------------------------- /Content/W_Panel.uasset: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:ba962f41afab87b9592cffa3a1175ac9dc3527e9573ba3e76d5b8cccb6d45e6b 3 | size 206693 4 | -------------------------------------------------------------------------------- /Platforms/HoloLens/Config/HoloLensEngine.ini: -------------------------------------------------------------------------------- 1 | 2 | 3 | [/Script/HoloLensPlatformEditor.HoloLensTargetSettings] 4 | bBuildForEmulation=False 5 | bBuildForDevice=True 6 | bUseNameForLogo=True 7 | bBuildForRetailWindowsStore=False 8 | bAutoIncrementVersion=False 9 | bShouldCreateAppInstaller=False 10 | AppInstallerInstallationURL= 11 | HoursBetweenUpdateChecks=0 12 | bEnablePIXProfiling=False 13 | TileBackgroundColor=(B=64,G=0,R=0,A=255) 14 | SplashScreenBackgroundColor=(B=64,G=0,R=0,A=255) 15 | +PerCultureResources=(CultureId="",Strings=(PackageDisplayName="",PublisherDisplayName="",PackageDescription="",ApplicationDisplayName="",ApplicationDescription=""),Images=()) 16 | TargetDeviceFamily=Windows.Holographic 17 | MinimumPlatformVersion= 18 | MaximumPlatformVersionTested=10.0.18362.0 19 | MaxTrianglesPerCubicMeter=500.000000 20 | SpatialMeshingVolumeSize=20.000000 21 | CompilerVersion=Default 22 | Windows10SDKVersion=10.0.18362.0 23 | +CapabilityList=internetClientServer 24 | +CapabilityList=privateNetworkClientServer 25 | +Uap2CapabilityList=spatialPerception 26 | bSetDefaultCapabilities=False 27 | SpatializationPlugin= 28 | SourceDataOverridePlugin= 29 | ReverbPlugin= 30 | OcclusionPlugin= 31 | SoundCueCookQualityIndex=-1 32 | 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AsyncLineTraceSample 2 | 大量のActorがLineTraceを行う時、AsyncLineTraceを使う事で負荷を軽減できるかもしれません。このサンプルでは、通常の`LineTraceByChannel`と`AsyncLineTraceByChannel`の負荷を比較します。 3 | 4 | ![image](https://user-images.githubusercontent.com/40533980/230411159-e0d00263-95d6-45d4-9c0d-6c31bddb0b6b.png) 5 | 6 | このサンプルでは接地判定をシミュレートしています。周期的にバウンドする球型のActorは、それぞれが自分の足元から3uu真下にLineTraceを行います。TraceがBlockされたら球は緑色に、そうでないときは青色になります。 7 | 8 | 9 | ## 対応バージョン 10 | UE5.1.1以降 11 | 12 | 13 | # 使い方 14 | チェックボックスを操作して、`stat unit`のGameの負荷がどのように変化するか確認してみて下さい。 15 | 16 | - `Use async trace` : 有効な場合は`AsyncLineTraceByChannel`を使います。 17 | - `Delay async result work until next tick` : 有効な場合は`AsyncLineTraceByChannel`でDelegateを設定せず、各Actorの次回Tickで結果を拾って作業します。 18 | 19 | 20 | # 遅延評価するかどうか 21 | ![image](https://user-images.githubusercontent.com/40533980/230517094-9e7674f9-8203-44f0-81b9-c551a3985572.png) 22 | 23 | Async Traceで行う仕事の性質で決めるのが良さそうです。 24 | 25 | 26 | # 参考資料 27 | - [Using Async Collision Traces in Unreal Engine 4 | by Bryan Corell | Medium](https://medium.com/@bryan.corell/using-async-collision-traces-in-unreal-engine-4-2cc312c825f5) 28 | - ほぼこちらのブログの実装を参考にさせて頂きました。有難や🙏 29 | - [60fpsアクションを実現する秘訣を伝授 解析編【UNREAL FEST EAST 2019】](https://www.docswell.com/s/EpicGamesJapan/ZQ1XEK-UE4_UFE19_Soleil_60fpsAction_Analysis) 30 | - `AsyncLineTraceByChannel`以外の負荷軽減テクニックも大量に掲載されています 31 | - [UE4 BPで使える非同期タスクやマルチスレッドのプラグインを比較してみる](https://unrealengine.hatenablog.com/entry/2020/07/26/182422) 32 | - BlueprintでAsyncLineTraceできるプラグインが紹介されています 33 | ---- 34 | 以上 35 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample.Target.cs: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class AsyncLineTraceSampleTarget : TargetRules 7 | { 8 | public AsyncLineTraceSampleTarget( TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Game; 11 | DefaultBuildSettings = BuildSettingsVersion.Latest; 12 | IncludeOrderVersion = EngineIncludeOrderVersion.Latest; 13 | ExtraModuleNames.Add("AsyncLineTraceSample"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample/AsyncLineTraceSample.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class AsyncLineTraceSample : ModuleRules 6 | { 7 | public AsyncLineTraceSample(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); 12 | 13 | PrivateDependencyModuleNames.AddRange(new string[] { }); 14 | 15 | // Uncomment if you are using Slate UI 16 | // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); 17 | 18 | // Uncomment if you are using online features 19 | // PrivateDependencyModuleNames.Add("OnlineSubsystem"); 20 | 21 | // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample/AsyncLineTraceSample.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "AsyncLineTraceSample.h" 4 | #include "Modules/ModuleManager.h" 5 | 6 | IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, AsyncLineTraceSample, "AsyncLineTraceSample" ); 7 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample/AsyncLineTraceSample.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample/AsyncLineTraceSampleGameModeBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | 4 | #include "AsyncLineTraceSampleGameModeBase.h" 5 | 6 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample/AsyncLineTraceSampleGameModeBase.h: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/GameModeBase.h" 7 | #include "AsyncLineTraceSampleGameModeBase.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class ASYNCLINETRACESAMPLE_API AAsyncLineTraceSampleGameModeBase : public AGameModeBase 14 | { 15 | GENERATED_BODY() 16 | 17 | }; 18 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample/AsyncTraceActor.cpp: -------------------------------------------------------------------------------- 1 | #include "AsyncTraceActor.h" 2 | 3 | // 参考: https://medium.com/@bryan.corell/using-async-collision-traces-in-unreal-engine-4-2cc312c825f5 4 | 5 | AAsyncTraceActor::AAsyncTraceActor() 6 | : bUseAsyncTrace(false) 7 | , bDelayAsyncWorkUntilNextTick(false) 8 | , bWantsAsyncTraceOnce(false) 9 | { 10 | PrimaryActorTick.bCanEverTick = true; 11 | } 12 | 13 | void AAsyncTraceActor::BeginPlay() 14 | { 15 | Super::BeginPlay(); 16 | 17 | if (!bDelayAsyncWorkUntilNextTick) { 18 | AsyncTraceDelegate.BindUObject(this, &ThisClass::OnTraceCompleted); 19 | } 20 | } 21 | 22 | void AAsyncTraceActor::SetWantsTrace() 23 | { 24 | if (bUseAsyncTrace) { 25 | // 多重にAsyncTraceを起動しないようにチェック 26 | // この段階でValidなHandleだった場合、既に有効な結果を得ている 27 | if (!GetWorld()->IsTraceHandleValid(LastAsyncTraceHandle, false)){ 28 | // 次回のtickで非同期Traceの実行を予約 29 | bWantsAsyncTraceOnce = true; 30 | } 31 | 32 | } else { 33 | // 同期Traceする 34 | UWorld* World = GetWorld(); 35 | if (World) { 36 | FHitResult result; 37 | 38 | ECollisionChannel Channel = UEngineTypes::ConvertToCollisionChannel(MyTraceType); 39 | FVector Start = GetTraceStart(); 40 | FVector End = GetTraceEnd(); 41 | FCollisionQueryParams Params(TEXT("AsyncRequestTrace"), 42 | false, 43 | this); 44 | 45 | World->LineTraceSingleByChannel(result, 46 | Start, 47 | End, 48 | Channel, 49 | Params); 50 | 51 | 52 | // 負荷比較のため、非同期Traceと同じイベントを起動する 53 | TArray Results; 54 | Results.Emplace(result); 55 | ReceiveOnTraceCompleted(Results); 56 | } 57 | } 58 | } 59 | 60 | FTraceHandle AAsyncTraceActor::RequestAsyncTrace() 61 | { 62 | UWorld* World = GetWorld(); 63 | if (World == nullptr) 64 | return FTraceHandle(); 65 | 66 | ECollisionChannel Channel = UEngineTypes::ConvertToCollisionChannel(MyTraceType); 67 | FVector Start = GetTraceStart(); 68 | FVector End = GetTraceEnd(); 69 | FCollisionQueryParams Params(TEXT("AsyncRequestTrace"), 70 | false, 71 | this); 72 | 73 | return World->AsyncLineTraceByChannel(EAsyncTraceType::Single, 74 | Start, End, 75 | Channel, 76 | Params, 77 | FCollisionResponseParams::DefaultResponseParam, 78 | &AsyncTraceDelegate); 79 | } 80 | 81 | void AAsyncTraceActor::OnTraceCompleted(const FTraceHandle& Handle, FTraceDatum& Data) 82 | { 83 | // 自分の指示したAsync Traceの戻りであるかどうか一応確認 84 | ensure(Handle == LastAsyncTraceHandle); 85 | 86 | // 結果を使って何か作業する 87 | DoWorkWithTraceResults(Data); 88 | 89 | // 同じ結果を再利用しないように判定用の値をリセット 90 | LastAsyncTraceHandle.Invalidate(); 91 | 92 | // フラグが切り替えられていたら、次回からTickで処理する 93 | if (bDelayAsyncWorkUntilNextTick) { 94 | AsyncTraceDelegate.Unbind(); 95 | } 96 | } 97 | 98 | void AAsyncTraceActor::DoWorkWithTraceResults(const FTraceDatum& TraceData) 99 | { 100 | // do things here 101 | ReceiveOnTraceCompleted(TraceData.OutHits); 102 | } 103 | 104 | void AAsyncTraceActor::Tick(float DeltaTime) 105 | { 106 | Super::Tick(DeltaTime); 107 | 108 | // 前回のTickでRequestTraceしてたら、LastAsyncTraceHandleに有効値が入ってるはず 109 | if (LastAsyncTraceHandle.IsValid()){ 110 | // Trace結果を拾って処理 111 | FTraceDatum OutData; 112 | if (GetWorld()->QueryTraceData(LastAsyncTraceHandle, OutData)){ 113 | OnTraceCompleted(LastAsyncTraceHandle, OutData); 114 | } 115 | 116 | if (!bDelayAsyncWorkUntilNextTick) { 117 | AsyncTraceDelegate.BindUObject(this, &ThisClass::OnTraceCompleted); 118 | } 119 | } 120 | 121 | if (bWantsAsyncTraceOnce){ 122 | LastAsyncTraceHandle = RequestAsyncTrace(); 123 | bWantsAsyncTraceOnce = false; 124 | } 125 | } 126 | 127 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSample/AsyncTraceActor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CoreMinimal.h" 4 | #include "GameFramework/Actor.h" 5 | #include "AsyncTraceActor.generated.h" 6 | 7 | // 参考: https://medium.com/@bryan.corell/using-async-collision-traces-in-unreal-engine-4-2cc312c825f5 8 | 9 | UCLASS() 10 | class ASYNCLINETRACESAMPLE_API AAsyncTraceActor : public AActor 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | AAsyncTraceActor(); 16 | 17 | protected: 18 | virtual void BeginPlay() override; 19 | 20 | 21 | protected: 22 | UFUNCTION(BlueprintCallable) 23 | void SetWantsTrace(); 24 | 25 | UFUNCTION(BlueprintImplementableEvent) 26 | void ReceiveOnTraceCompleted(const TArray& Results); 27 | 28 | UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) 29 | FVector GetTraceStart() const; 30 | 31 | UFUNCTION(BlueprintImplementableEvent, BlueprintCallable) 32 | FVector GetTraceEnd() const; 33 | 34 | FTraceHandle RequestAsyncTrace(); 35 | void OnTraceCompleted(const FTraceHandle& Handle, FTraceDatum& Data); 36 | void DoWorkWithTraceResults(const FTraceDatum& TraceData); 37 | 38 | UPROPERTY(EditAnywhere, BlueprintReadWrite) 39 | TEnumAsByte MyTraceType; 40 | 41 | UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = true)) 42 | bool bUseAsyncTrace; // 非同期で足元Traceするかどうか。falseならSetWantsTrace()で通常のLineTraceする 43 | 44 | UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (ExposeOnSpawn = true)) 45 | bool bDelayAsyncWorkUntilNextTick; // async traceした結果の処理を次回のtickまで遅延するかどうか 46 | 47 | private: 48 | FTraceHandle LastAsyncTraceHandle; 49 | FTraceDelegate AsyncTraceDelegate; 50 | uint32 bWantsAsyncTraceOnce : 1; // Async Traceのリクエストがある時にtrueになる 51 | 52 | 53 | public: 54 | virtual void Tick(float DeltaTime) override; 55 | 56 | }; 57 | -------------------------------------------------------------------------------- /Source/AsyncLineTraceSampleEditor.Target.cs: -------------------------------------------------------------------------------- 1 | // Copyright Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class AsyncLineTraceSampleEditorTarget : TargetRules 7 | { 8 | public AsyncLineTraceSampleEditorTarget( TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Editor; 11 | DefaultBuildSettings = BuildSettingsVersion.Latest; 12 | IncludeOrderVersion = EngineIncludeOrderVersion.Latest; 13 | ExtraModuleNames.Add("AsyncLineTraceSample"); 14 | } 15 | } 16 | --------------------------------------------------------------------------------