原文:https://blog.csdn.net/zhouschina/article/details/8784908 已知三点p1(x1,y1,z1),p2(x2,y2,z2),p3(x3,y3,z3),要求确定的平面方程。 关键在于求出平面的一个法向量,为此做向量p1p2(x2-x1,y2-y1,z2-z1), p1p3(x3-x1,y3-y1,z3-z1),平面法线和这两个向量垂直,因此法向量n: 平面方程: a * (x - x1) + b * (y - y1) + c * (z - z1) = 0; d = -a * x1 - b * y1 - c * z1; 平面方程2: a * x + b * y + c * z + d=0; 代码: //已知3点坐标,求平面ax+by+cz+d=0; void get_panel(Point p1, Point p2, Point p3, double &a, double &b, double &c, double &d) { a = ( (p2.

Continue reading

算法1 原文:https://blog.csdn.net/zhouschina/article/details/14647587 假设空间某点O的坐标为(Xo,Yo,Zo),空间某条直线上两点A和B的坐标为:(X1,Y1,Z1),(X2,Y2,Z2),设点O在直线AB上的垂足为点N,坐标为(Xn,Yn,Zn)。点N坐标解算过程如下: 首先求出下列向量: 由向量垂直关系(公式1): 点N在直线AB上,根据向量共线(公式2): 由公式2得(公式3): 把公式3式代入公式1式,式中只有一个未知数k,整理化简解出k(公式4): 把公式4式代入公式3式即得到垂足N的坐标。 二维空间 // 二维空间点到直线的垂足 struct Point { double x,y; } Point GetFootOfPerpendicular( const Point &pt, // 直线外一点 const Point &begin, // 直线开始点 const Point &end) // 直线结束点 { Point retVal; double dx = begin.x - end.x; double dy = begin.y - end.y; if(abs(dx) < 0.00000001 && abs(dy) < 0.00000001 ) { retVal = begin; return retVal; } double u = (pt.

Continue reading

[UE4]Root Motion

Root Motion 设置步骤: 先在 AnimSequence 的Asset Detail面板中勾选EnableRootMotion和Force Root Lock`。 然后基于该 AnimSequence 新建一个 AnimMontage。 然后再在 AnimationBluerpint 中设置Root Motion Mode为 Root Motion From Montages Only(Class Defaults 面板下,不是Class Settings)。 如果你没有使用UE4的服务器、或者使用了UE4服务器但是没有对动画启用Replication(服务端通过 NetMulticast 播放动画),设置为Root Motion from Enerything没有问题,如果使用了UE4的Replication,且这些动画文件(AnimSequence, Blendspace, AnimMontage, etc.)勾选了EnableRootMotion,那么 Root Motion 也会被同步,影响性能。所以官方文档上的建议是使用默认设置,即:Root Motion Mode设置为Root Motion From Montages Only,只对Montage的Root Motion进行Replication。 Root Motion https://docs.unrealengine.com/en-US/Engine/Animation/RootMotion

Continue reading

enum 1, define UENUM() enum Status { Stopped UMETA(DisplayName = "Stopped"), Moving UMETA(DisplayName = "Moving"), Attacking UMETA(DisplayName = "Attacking"), }; 2, using UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Status) TEnumAsByte<Status> status; struct 1, define USTRUCT(BlueprintType) struct TESTPROJ_API FMyStruct { GENERATED_USTRUCT_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Test") int32 Test; FMyStruct() { } }; 2, using UPROPERTY(EditDefaultsOnly, BlueprintReadOnly) FMyStruct Test;

Continue reading

Compiling Error: error C2664: 'void TestFun01(std::string &)': cannot convert argument 1 from 'const char [5]' to 'std::string &' Solution: add const to std::string& which is a parameter of function, like this: void TestFun01(const std::string& text) { std::cout << text; } void TestFun02() { TestFun01("abcd"); } this would produce compiling error: void TestFun01(std::string& text) { std::cout << text; } void TestFun02() { TestFun01("abcd"); }

Continue reading

[UE4]Assertions

Reporting errors and halting execution. check(): like assert() in C, can be disabled by DO_CHECK 0 verify(): like check(), but the expression is still executed on DO_CHECK 0 (e.g. for variable assignments) disadvantage: halts program execution (application ends, Editor users can loose unsaved work). when to use: catch fatal errors Reporting errors and halting execution exclusively in debug builds. checkSlow(), checkfSlow(), verifySlow() (see (1)) difference to (1): they are only active in debug builds (when DO_GUARD_SLOW 1)

Continue reading

Creating Interactive Grass in Unreal Engine 4 https://www.raywenderlich.com/6314-creating-interactive-grass-in-unreal-engine-4 Creating Snow Trails in Unreal Engine 4 https://www.raywenderlich.com/5760-creating-snow-trails-in-unreal-engine-4 Dynamic Mesh Painting in Unreal Engine 4 https://www.raywenderlich.com/6817-dynamic-mesh-painting-in-unreal-engine-4 Custom Depth in Unreal Engine 4 https://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/

Continue reading

Error 1 Error Log: A problem occurred configuring root project 'app'. > Could not resolve all files for configuration ':classpath'. > Could not download kotlin-reflect.jar (org.jetbrains.kotlin:kotlin-reflect:1.1.3-2) > Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'. > Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-reflect/1.1.3-2/kotlin-reflect-1.1.3-2.jar'. > Software caused connection abort: recv failed > Could not download protobuf-java.jar (com.google.protobuf:protobuf-java:3.0.0) > Could not get resource 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'. > Could not GET 'https://jcenter.bintray.com/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar'. > Software caused connection abort: recv failed Solution:

Continue reading

如何修改SteamWorks中游戏名称 改名需要改两个地方:一个是Application Name,一个是Package Name。 修改Application Name 先打开SteamWork首页,点击App名称,进入App Admin页面 然后点击“Edit Steamworks Settings” 然后修改Application Name,并点击Save 修改Package Name 先打开SteamWork首页,点击App名称,进入App Admin页面 然后点击Package Title 然后点击Edit package name。 游戏包体构建与上传(SteamPipe Depot & Build) 1,将游戏包体放在E:\SteamSdk\tools\ContentBuilder\content 目录下。一般为了区分windows / mac os,可以在 content 目录下见两个文件夹:windows 和 macos,然后将对应包体文件放在对应文件夹下。 2, 编辑 E:\SteamSdk\tools\ContentBuilder\scripts\ 下的app_build_1000.vdf 和 depot_build_1001.vdf。 将 app_build_1000.vdf 和 depot_build_1001.vdf 改名,分别改成自己项目的 appid 和 depotid,例如: app_build_2000.vdf、depot_build_2001.vdf。 然后修改 app_build_2000.vdf 中的内容,改成正式的 appid 和 depotid 修改 depot_build_2001.

Continue reading

Keywords:运行时期间修改后处理设置, change post process settings when game is running. 运行时修改Post Process 步骤 1,使用 Camera Component 拉出 Set members in PostProcessSettings 节点。 Get reference to Camera Component and drag out “Set members in PostProcessSettings” node. 2,选中 Set members in PostProcessSettings 节点,然后再在 Detail 面板中勾选需要修改的属性。比如我想修改曝光亮度。 select “Set members in PostProcessSettings” node, then checked properties which want to modify in Detail Panel. e.g. Brightness of Exposure. 3,将 Camera 组件的 属性” Post Process Blend Weight” 设置为1,表示完全启用摄像机的 Post Process Settings。0表示完全禁用,0到1的数值表示混合过渡“全完启用”到“完全禁用”之间的渐变效果。

Continue reading

[Math]Parabola movement

keywords:抛物运动、Parabola、重力加速度、Gravitational Speed 、UE4 implement. header AStaticMeshActor* TestCube = nullptr; //throw speed UPROPERTY(EditDefaultsOnly) FVector StartForce = FVector(100.f, 100.f, 2000.f); //gravitational acceleration float GravityAcclerator = -980.f; //accumulated movtion time float AccumulateTime = 0.f; cpp void ATestTPGameMode::StartPlay() { Super::StartPlay(); //finding the Actor in scene. for (TActorIterator<AStaticMeshActor> Iter(GetWorld()); Iter; ++Iter) { if (Iter->GetName() == TEXT("Cube_2")) { TestCube = *Iter; break; } } } void ATestTPGameMode::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds); AccumulateTime += DeltaSeconds; //calculate gravitational speed in real time.

Continue reading

EndPlay、BeginDestroy、Destroy 的调用时机 如果要获取 Actor 销毁时的准确时间点,建议重写 Destroy() 函数,而不是EndPlay()、BeginDestroy()。 官方文档上说 EndPlay 会在执行Destroy的时候触发,但实际上并不会(至少4.20版本中测试过不会),而是当 Actor 所在场景销毁时(比如退出编辑器)才会调用。 BeginDestroy()、IsReadyForFinishDestroy()、FinishDestroy() 是在执行垃圾回收时才会触发的函数,而不是对象被 Destroy 后立即执行的函数。 官方文档 https://docs.unrealengine.com/en-us/Programming/UnrealArchitecture/Actors/ActorLifecycle

Continue reading

Author's picture

Neil Wang

久长唯有品格

To Be Marvelous

Yichang·Hubei