【问题标题】:Calculate the force of interaction of objects in UE计算UE中物体的相互作用力
【发布时间】:2022-01-04 16:21:51
【问题描述】:

我想计算碰撞的力。比如车在桥上,我想找 压力。在第二种情况下,我有一辆坠落的汽车,我想找出撞击的力量。有什么功能吗?

我想用 c++。

【问题讨论】:

    标签: unreal-engine4 unreal-engine5


    【解决方案1】:

    你所做的就是将质量和速度相乘

    void AMyActor::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
    {
       float HitForce = OtherActor->GetVelocity.Size() * OtherComp->GetMass();
       UE_LOG(LogTemp, Warning, TEXT(HitForce));
    }
    

    HitForce 是您要查找的变量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-07
      • 1970-01-01
      相关资源
      最近更新 更多