本文整理汇总了C++中UPrimitiveComponent::IsAnySimulatingPhysics方法的典型用法代码示例。如果您正苦于以下问题:C++ UPrimitiveComponent::IsAnySimulatingPhysics方法的具体用法?C++ UPrimitiveComponent::IsAnySimulatingPhysics怎么用?C++ UPrimitiveComponent::IsAnySimulatingPhysics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UPrimitiveComponent
的用法示例。
在下文中一共展示了UPrimitiveComponent::IsAnySimulatingPhysics方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//.........这里部分代码省略.........
{
CollisionPayload.UsedCollisions--;
}
if (CollisionPayload.UsedCollisions > 0)
{
if (LODLevel->RequiredModule->bUseLocalSpace)
{
// Transform the particle velocity to world space
FVector OldVelocity = OwnerTM.TransformVector(Particle.Velocity);
FVector BaseVelocity = OwnerTM.TransformVector(Particle.BaseVelocity);
BaseVelocity = BaseVelocity.MirrorByVector(Hit.Normal) * CollisionPayload.UsedDampingFactor;
Particle.BaseVelocity = OwnerTM.InverseTransformVector(BaseVelocity);
Particle.BaseRotationRate = Particle.BaseRotationRate * CollisionPayload.UsedDampingFactorRotation.X;
if (bMeshRotationActive && MeshRotationOffset > 0)
{
FMeshRotationPayloadData* PayloadData = (FMeshRotationPayloadData*)((uint8*)&Particle + MeshRotationOffset);
PayloadData->RotationRateBase *= CollisionPayload.UsedDampingFactorRotation;
}
// Reset the current velocity and manually adjust location to bounce off based on normal and time of collision.
FVector NewVelocity = Direction.MirrorByVector(Hit.Normal) * (Location - OldLocation).Size() * CollisionPayload.UsedDampingFactor;
Particle.Velocity = FVector::ZeroVector;
// New location
FVector NewLocation = Location + NewVelocity * (1.f - Hit.Time);
Particle.Location = OwnerTM.InverseTransformPosition(NewLocation);
if (bApplyPhysics)
{
check(IsInGameThread());
UPrimitiveComponent* PrimitiveComponent = Hit.Component.Get();
if(PrimitiveComponent && PrimitiveComponent->IsAnySimulatingPhysics())
{
FVector vImpulse;
vImpulse = -(NewVelocity - OldVelocity) * ParticleMass.GetValue(Particle.RelativeTime, Owner->Component);
PrimitiveComponent->AddImpulseAtLocation(vImpulse, Hit.Location, Hit.BoneName);
}
}
}
else
{
FVector vOldVelocity = Particle.Velocity;
// Reflect base velocity and apply damping factor.
Particle.BaseVelocity = Particle.BaseVelocity.MirrorByVector(Hit.Normal) * CollisionPayload.UsedDampingFactor;
Particle.BaseRotationRate = Particle.BaseRotationRate * CollisionPayload.UsedDampingFactorRotation.X;
if (bMeshRotationActive && MeshRotationOffset > 0)
{
FMeshRotationPayloadData* PayloadData = (FMeshRotationPayloadData*)((uint8*)&Particle + MeshRotationOffset);
PayloadData->RotationRateBase *= CollisionPayload.UsedDampingFactorRotation;
}
// Reset the current velocity and manually adjust location to bounce off based on normal and time of collision.
FVector vNewVelocity = Direction.MirrorByVector(Hit.Normal) * (Location - OldLocation).Size() * CollisionPayload.UsedDampingFactor;
Particle.Velocity = FVector::ZeroVector;
Particle.Location += vNewVelocity * (1.f - Hit.Time);
if (bApplyPhysics)
{
check(IsInGameThread());
UPrimitiveComponent* PrimitiveComponent = Hit.Component.Get();
if(PrimitiveComponent && PrimitiveComponent->IsAnySimulatingPhysics())
{
FVector vImpulse;