本文整理汇总了C++中FVector::MirrorByVector方法的典型用法代码示例。如果您正苦于以下问题:C++ FVector::MirrorByVector方法的具体用法?C++ FVector::MirrorByVector怎么用?C++ FVector::MirrorByVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FVector
的用法示例。
在下文中一共展示了FVector::MirrorByVector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//.........这里部分代码省略.........
{
bool bDecrementMaxCount = true;
bool bIgnoreCollision = false;
if (Hit.GetActor())
{
bDecrementMaxCount = !bPawnsDoNotDecrementCount || !Cast<APawn>(Hit.GetActor());
bIgnoreCollision = bIgnoreTriggerVolumes && Hit.GetActor()->IsA(ATriggerBase::StaticClass());
//@todo.SAS. Allow for PSys to say what it wants to collide w/?
}
if (bIgnoreCollision == false)
{
if (bDecrementMaxCount && (bOnlyVerticalNormalsDecrementCount == true))
{
if ((Hit.Normal.IsNearlyZero() == false) && (FMath::Abs(Hit.Normal.Z) + VerticalFudgeFactor) < 1.0f)
{
//UE_LOG(LogParticles, Log, TEXT("Particle from %s had a non-vertical hit!"), *(Owner->Component->Template->GetPathName()));
bDecrementMaxCount = false;
}
}
if (bDecrementMaxCount)
{
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;