本文整理匯總了C#中ParticlePlayground.PlaygroundParticlesC.HasTurbulence方法的典型用法代碼示例。如果您正苦於以下問題:C# PlaygroundParticlesC.HasTurbulence方法的具體用法?C# PlaygroundParticlesC.HasTurbulence怎麽用?C# PlaygroundParticlesC.HasTurbulence使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ParticlePlayground.PlaygroundParticlesC
的用法示例。
在下文中一共展示了PlaygroundParticlesC.HasTurbulence方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ThreadedCalculations
//.........這裏部分代碼省略.........
new Vector3(
playgroundParticles.playgroundCache.velocity[p].x*playgroundParticles.velocityBending.x,
playgroundParticles.playgroundCache.velocity[p].y*playgroundParticles.velocityBending.y,
playgroundParticles.playgroundCache.velocity[p].z*playgroundParticles.velocityBending.z
),
(playgroundParticles.playgroundCache.targetPosition[p]-playgroundParticles.playgroundCache.position[p]).normalized
)*t;
} else {
playgroundParticles.playgroundCache.velocity[p] += Vector3.Reflect(
new Vector3(
playgroundParticles.playgroundCache.velocity[p].x*playgroundParticles.velocityBending.x,
playgroundParticles.playgroundCache.velocity[p].y*playgroundParticles.velocityBending.y,
playgroundParticles.playgroundCache.velocity[p].z*playgroundParticles.velocityBending.z
),
(playgroundParticles.playgroundCache.previousParticlePosition[p]-playgroundParticles.playgroundCache.position[p]).normalized
)*t;
}
}
// Set previous target position (used by delta velocity & local space movement compensation)
playgroundParticles.playgroundCache.previousTargetPosition[p] = playgroundParticles.playgroundCache.targetPosition[p];
// Gravity
if (playgroundParticles.localSpace && playgroundParticles.source==SOURCEC.Transform && playgroundParticles.transformIndex!=playgroundParticles.psTransformNum)
playgroundParticles.playgroundCache.velocity[p] -= playgroundParticles.sourceTransforms[playgroundParticles.transformIndex].rotation*playgroundParticles.gravity*t;
else
playgroundParticles.playgroundCache.velocity[p] -= playgroundParticles.gravity*t;
// Lifetime additive velocity
if (playgroundParticles.applyLifetimeVelocity)
playgroundParticles.playgroundCache.velocity[p] += playgroundParticles.lifetimeVelocity.Evaluate(normalizedLife, playgroundParticles.lifetimeVelocityScale)*t;
// Turbulence inside the calculation loop
if (playgroundParticles.HasTurbulence() && PlaygroundC.reference.turbulenceThreadMethod==ThreadMethodComponent.InsideParticleCalculation) {
if (!playgroundParticles.playgroundCache.noForce[p])
Turbulence(playgroundParticles, playgroundParticles.turbulenceSimplex, p, playgroundParticles.t, playgroundParticles.turbulenceType, playgroundParticles.turbulenceTimeScale, playgroundParticles.turbulenceScale/playgroundParticles.velocityScale, playgroundParticles.turbulenceStrength, playgroundParticles.turbulenceApplyLifetimeStrength, playgroundParticles.turbulenceLifetimeStrength);
}
// Damping, max velocity, constraints and final positioning
// Max velocity
if (playgroundParticles.playgroundCache.velocity[p].sqrMagnitude>playgroundParticles.maxVelocity)
playgroundParticles.playgroundCache.velocity[p] = Vector3.ClampMagnitude(playgroundParticles.playgroundCache.velocity[p], playgroundParticles.maxVelocity);
// Damping
if (playgroundParticles.damping>0)
playgroundParticles.playgroundCache.velocity[p] = Vector3.Lerp(playgroundParticles.playgroundCache.velocity[p], zero, playgroundParticles.damping*t);
// Transition back to source
if (playgroundParticles.transitionBackToSource) {
float transitionAmount = playgroundParticles.transitionBackToSourceAmount.Evaluate(normalizedLife)*playgroundParticles.particleTimescale;
playgroundParticles.playgroundCache.position[p] = Vector3.Lerp(playgroundParticles.playgroundCache.position[p], playgroundParticles.playgroundCache.targetPosition[p], transitionAmount);
playgroundParticles.playgroundCache.velocity[p] *= 1f-transitionAmount;
}
// Axis constraints
if (playgroundParticles.axisConstraints.x)
playgroundParticles.playgroundCache.velocity[p].x = 0;
if (playgroundParticles.axisConstraints.y)
playgroundParticles.playgroundCache.velocity[p].y = 0;
if (playgroundParticles.axisConstraints.z)
playgroundParticles.playgroundCache.velocity[p].z = 0;
// Set calculated collision position
playgroundParticles.playgroundCache.collisionParticlePosition[p] = playgroundParticles.playgroundCache.position[p];
示例2: ThreadedCalculations
//.........這裏部分代碼省略.........
playgroundParticles.playgroundCache.velocity[p].z*playgroundParticles.velocityBending.z
),
(playgroundParticles.playgroundCache.targetPosition[p]-playgroundParticles.playgroundCache.position[p]).normalized
)*t;
} else {
playgroundParticles.playgroundCache.velocity[p] += Vector3.Reflect(
new Vector3(
playgroundParticles.playgroundCache.velocity[p].x*playgroundParticles.velocityBending.x,
playgroundParticles.playgroundCache.velocity[p].y*playgroundParticles.velocityBending.y,
playgroundParticles.playgroundCache.velocity[p].z*playgroundParticles.velocityBending.z
),
(playgroundParticles.playgroundCache.previousParticlePosition[p]-playgroundParticles.playgroundCache.position[p]).normalized
)*t;
}
}
// Delta velocity
if (!playgroundParticles.cameFromNonEmissionFrame && playgroundParticles.calculateDeltaMovement && playgroundParticles.playgroundCache.life[p]==0 && playgroundParticles.source!=SOURCEC.Script) {
deltaVelocity = playgroundParticles.playgroundCache.targetPosition[p]-(playgroundParticles.playgroundCache.previousTargetPosition[p]);
playgroundParticles.playgroundCache.velocity[p] += deltaVelocity*playgroundParticles.deltaMovementStrength;
}
// Set previous target position (used by delta velocity & local space movement compensation)
playgroundParticles.playgroundCache.previousTargetPosition[p] = playgroundParticles.playgroundCache.targetPosition[p];
// Gravity
playgroundParticles.playgroundCache.velocity[p] -= playgroundParticles.gravity*t;
// Lifetime additive velocity
if (playgroundParticles.applyLifetimeVelocity)
playgroundParticles.playgroundCache.velocity[p] += playgroundParticles.lifetimeVelocity.Evaluate(normalizedLife, playgroundParticles.lifetimeVelocityScale)*t;
// Turbulence inside the calculation loop
if (playgroundParticles.HasTurbulence() && PlaygroundC.reference.turbulenceThreadMethod==ThreadMethodComponent.InsideParticleCalculation) {
if (!playgroundParticles.playgroundCache.noForce[p])
Turbulence (playgroundParticles, playgroundParticles.turbulenceSimplex, p, playgroundParticles.t, playgroundParticles.turbulenceType, playgroundParticles.turbulenceTimeScale, playgroundParticles.turbulenceScale/playgroundParticles.velocityScale, playgroundParticles.turbulenceStrength, playgroundParticles.turbulenceApplyLifetimeStrength, playgroundParticles.turbulenceLifetimeStrength);
}
// Damping, max velocity, constraints and final positioning
if (playgroundParticles.playgroundCache.velocity[p]!=zero) {
// Max velocity
if (playgroundParticles.playgroundCache.velocity[p].sqrMagnitude>playgroundParticles.maxVelocity)
playgroundParticles.playgroundCache.velocity[p] = Vector3.ClampMagnitude(playgroundParticles.playgroundCache.velocity[p], playgroundParticles.maxVelocity);
// Damping
if (playgroundParticles.damping>0)
playgroundParticles.playgroundCache.velocity[p] = Vector3.Lerp(playgroundParticles.playgroundCache.velocity[p], zero, playgroundParticles.damping*t);
// Axis constraints
if (playgroundParticles.axisConstraints.x)
playgroundParticles.playgroundCache.velocity[p].x = 0;
if (playgroundParticles.axisConstraints.y)
playgroundParticles.playgroundCache.velocity[p].y = 0;
if (playgroundParticles.axisConstraints.z)
playgroundParticles.playgroundCache.velocity[p].z = 0;
// Set calculated collision position
playgroundParticles.playgroundCache.collisionParticlePosition[p] = playgroundParticles.playgroundCache.previousParticlePosition[p];
// Relocate
playgroundParticles.playgroundCache.position[p] += (playgroundParticles.playgroundCache.velocity[p]*playgroundParticles.velocityScale)*t;
if (playgroundParticles.applyLocalSpaceMovementCompensation) {
if (!playgroundParticles.applyMovementCompensationLifetimeStrength)
playgroundParticles.playgroundCache.position[p] += playgroundParticles.playgroundCache.localSpaceMovementCompensation[p];
else