feat: allow F3D projectiles to register a hit on hit feedback targets

This commit is contained in:
Jakob Feldmann 2024-05-09 15:19:01 +02:00
parent 9ac205b950
commit ce48ac64b8
3 changed files with 244 additions and 55 deletions

View File

@ -13,12 +13,12 @@ namespace FORGE3D
public float RaycastAdvance = 2f; // Raycast advance multiplier public float RaycastAdvance = 2f; // Raycast advance multiplier
public bool DelayDespawn = false; // Projectile despawn flag public bool DelayDespawn = false; // Projectile despawn flag
public ParticleSystem[] delayedParticles; // Array of delayed particles public ParticleSystem[] delayedParticles; // Array of delayed particles
ParticleSystem[] particles; // Array of projectile particles ParticleSystem[] particles; // Array of projectile particles
new Transform transform; // Cached transform new Transform transform; // Cached transform
RaycastHit hitPoint; // Raycast structure RaycastHit hitPoint; // Raycast structure
bool isHit = false; // Projectile hit flag bool isHit = false; // Projectile hit flag
bool isFXSpawned = false; // Hit FX prefab spawned flag bool isFXSpawned = false; // Hit FX prefab spawned flag
float timer = 0f; // Projectile timer float timer = 0f; // Projectile timer
float fxOffset; // Offset of fxImpact float fxOffset; // Offset of fxImpact
void Awake() void Awake()
@ -36,15 +36,16 @@ namespace FORGE3D
isFXSpawned = false; isFXSpawned = false;
timer = 0f; timer = 0f;
hitPoint = new RaycastHit(); hitPoint = new RaycastHit();
}
// OnDespawned called by pool manager }
public void OnDespawned()
{
}
// Stop attached particle systems emission and allow them to fade out before despawning // OnDespawned called by pool manager
void Delay() public void OnDespawned()
{
}
// Stop attached particle systems emission and allow them to fade out before despawning
void Delay()
{ {
if (particles.Length > 0 && delayedParticles.Length > 0) if (particles.Length > 0 && delayedParticles.Length > 0)
{ {
@ -138,11 +139,16 @@ namespace FORGE3D
{ {
isHit = true; isHit = true;
// Invoke delay routine if required if (hitPoint.collider.gameObject.TryGetComponent(out HitFeedbackTestObjectBehavior obj))
if (DelayDespawn) {
{ obj.Hit();
// Reset projectile timer and let particles systems stop emitting and fade out correctly }
timer = 0f;
// Invoke delay routine if required
if (DelayDespawn)
{
// Reset projectile timer and let particles systems stop emitting and fade out correctly
timer = 0f;
Delay(); Delay();
} }
} }

View File

@ -26,13 +26,14 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000} m_GameObject: {fileID: 100000}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.4, y: 2.4, z: 2.4} m_LocalScale: {x: 2.4, y: 2.4, z: 2.4}
m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 400004} - {fileID: 400004}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!198 &19800000 --- !u!198 &19800000
ParticleSystem: ParticleSystem:
@ -41,19 +42,19 @@ ParticleSystem:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100000} m_GameObject: {fileID: 100000}
serializedVersion: 6 serializedVersion: 8
lengthInSec: 1 lengthInSec: 1
simulationSpeed: 1 simulationSpeed: 1
stopAction: 0 stopAction: 0
cullingMode: 1 cullingMode: 1
ringBufferMode: 0 ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1} ringBufferLoopRange: {x: 0, y: 1}
emitterVelocityMode: 0
looping: 1 looping: 1
prewarm: 0 prewarm: 0
playOnAwake: 1 playOnAwake: 1
useUnscaledTime: 0 useUnscaledTime: 0
autoRandomSeed: 1 autoRandomSeed: 1
useRigidbodyForVelocity: 1
startDelay: startDelay:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
@ -252,6 +253,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -281,6 +283,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
startSize: startSize:
@ -566,7 +569,9 @@ ParticleSystem:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
randomizeRotationDirection: 0 randomizeRotationDirection: 0
gravitySource: 0
maxNumParticles: 1000 maxNumParticles: 1000
customEmitterVelocity: {x: 0, y: 0, z: 0}
size3D: 0 size3D: 0
rotation3D: 0 rotation3D: 0
gravityModifier: gravityModifier:
@ -1667,6 +1672,7 @@ ParticleSystem:
atime6: 53585 atime6: 53585
atime7: 65535 atime7: 65535
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 8 m_NumAlphaKeys: 8
minGradient: minGradient:
@ -1696,6 +1702,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 4 m_NumAlphaKeys: 4
UVModule: UVModule:
@ -2464,6 +2471,62 @@ ParticleSystem:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
LifetimeByEmitterSpeedModule:
enabled: 0
m_Curve:
serializedVersion: 2
minMaxState: 1
scalar: 1
minScalar: 1
maxCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: -0.8
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.2
inSlope: -0.8
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
minCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_Range: {x: 0, y: 1}
ForceModule: ForceModule:
enabled: 0 enabled: 0
x: x:
@ -3806,6 +3869,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -3835,24 +3899,26 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
range: {x: 0, y: 2.4} range: {x: 0, y: 2.4}
CollisionModule: CollisionModule:
enabled: 0 enabled: 0
serializedVersion: 3 serializedVersion: 4
type: 0 type: 0
collisionMode: 0 collisionMode: 0
colliderForce: 0 colliderForce: 0
multiplyColliderForceByParticleSize: 0 multiplyColliderForceByParticleSize: 0
multiplyColliderForceByParticleSpeed: 0 multiplyColliderForceByParticleSpeed: 0
multiplyColliderForceByCollisionAngle: 1 multiplyColliderForceByCollisionAngle: 1
plane0: {fileID: 0} m_Planes:
plane1: {fileID: 0} - {fileID: 0}
plane2: {fileID: 0} - {fileID: 0}
plane3: {fileID: 0} - {fileID: 0}
plane4: {fileID: 0} - {fileID: 0}
plane5: {fileID: 0} - {fileID: 0}
- {fileID: 0}
m_Dampen: m_Dampen:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
@ -4026,17 +4092,20 @@ ParticleSystem:
interiorCollisions: 0 interiorCollisions: 0
TriggerModule: TriggerModule:
enabled: 0 enabled: 0
collisionShape0: {fileID: 0} serializedVersion: 2
collisionShape1: {fileID: 0}
collisionShape2: {fileID: 0}
collisionShape3: {fileID: 0}
collisionShape4: {fileID: 0}
collisionShape5: {fileID: 0}
inside: 1 inside: 1
outside: 0 outside: 0
enter: 0 enter: 0
exit: 0 exit: 0
colliderQueryMode: 0
radiusScale: 1 radiusScale: 1
primitives:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
SubModule: SubModule:
serializedVersion: 2 serializedVersion: 2
enabled: 0 enabled: 0
@ -4220,6 +4289,7 @@ ParticleSystem:
m_RotationOrder: 4 m_RotationOrder: 4
minVertexDistance: 0.2 minVertexDistance: 0.2
textureMode: 0 textureMode: 0
textureScale: {x: 1, y: 1}
ribbonCount: 1 ribbonCount: 1
shadowBias: 0.5 shadowBias: 0.5
worldSpace: 0 worldSpace: 0
@ -4262,6 +4332,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -4291,6 +4362,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
widthOverTrail: widthOverTrail:
@ -4378,6 +4450,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -4407,6 +4480,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
CustomDataModule: CustomDataModule:
@ -4445,6 +4519,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -4474,6 +4549,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
colorLabel0: Color colorLabel0: Color
@ -4727,6 +4803,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -4756,6 +4833,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
colorLabel1: Color colorLabel1: Color
@ -4987,10 +5065,12 @@ ParticleSystemRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 0 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0 m_ReflectionProbeUsage: 0
m_RayTracingMode: 0 m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -5017,6 +5097,7 @@ ParticleSystemRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 0 m_RenderMode: 0
m_MeshDistribution: 0
m_SortMode: 0 m_SortMode: 0
m_MinParticleSize: 0 m_MinParticleSize: 0
m_MaxParticleSize: 50 m_MaxParticleSize: 50
@ -5029,15 +5110,23 @@ ParticleSystemRenderer:
m_RenderAlignment: 0 m_RenderAlignment: 0
m_Pivot: {x: 0, y: 0, z: 0} m_Pivot: {x: 0, y: 0, z: 0}
m_Flip: {x: 0, y: 0, z: 0} m_Flip: {x: 0, y: 0, z: 0}
m_UseCustomVertexStreams: 0
m_EnableGPUInstancing: 0 m_EnableGPUInstancing: 0
m_ApplyActiveColorSpace: 0 m_ApplyActiveColorSpace: 0
m_AllowRoll: 1 m_AllowRoll: 1
m_FreeformStretching: 0
m_RotateWithStretchDirection: 1
m_UseCustomVertexStreams: 0
m_VertexStreams: 0001030405 m_VertexStreams: 0001030405
m_UseCustomTrailVertexStreams: 0
m_TrailVertexStreams: 00010304
m_Mesh: {fileID: 0} m_Mesh: {fileID: 0}
m_Mesh1: {fileID: 0} m_Mesh1: {fileID: 0}
m_Mesh2: {fileID: 0} m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0} m_Mesh3: {fileID: 0}
m_MeshWeighting: 1
m_MeshWeighting1: 1
m_MeshWeighting2: 1
m_MeshWeighting3: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
--- !u!114 &11400000 --- !u!114 &11400000
MonoBehaviour: MonoBehaviour:
@ -5054,10 +5143,10 @@ MonoBehaviour:
fxType: 4 fxType: 4
layerMask: layerMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 9
lifeTime: 5 lifeTime: 5
despawnDelay: 1 despawnDelay: 1
velocity: 200 velocity: 75
RaycastAdvance: 2 RaycastAdvance: 2
DelayDespawn: 1 DelayDespawn: 1
delayedParticles: delayedParticles:
@ -5087,12 +5176,13 @@ Transform:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004} m_GameObject: {fileID: 100004}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 1, z: 0, w: -0.00000004371139} m_LocalRotation: {x: 0, y: 1, z: 0, w: -0.00000004371139}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.5, y: 0.5, z: 0.5} m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 400000} m_Father: {fileID: 400000}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!198 &19800004 --- !u!198 &19800004
ParticleSystem: ParticleSystem:
@ -5101,19 +5191,19 @@ ParticleSystem:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 100004} m_GameObject: {fileID: 100004}
serializedVersion: 6 serializedVersion: 8
lengthInSec: 1 lengthInSec: 1
simulationSpeed: 1 simulationSpeed: 1
stopAction: 0 stopAction: 0
cullingMode: 3 cullingMode: 3
ringBufferMode: 0 ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1} ringBufferLoopRange: {x: 0, y: 1}
emitterVelocityMode: 1
looping: 1 looping: 1
prewarm: 0 prewarm: 0
playOnAwake: 1 playOnAwake: 1
useUnscaledTime: 0 useUnscaledTime: 0
autoRandomSeed: 1 autoRandomSeed: 1
useRigidbodyForVelocity: 1
startDelay: startDelay:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
@ -5276,6 +5366,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -5305,6 +5396,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
startSize: startSize:
@ -5590,7 +5682,9 @@ ParticleSystem:
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
randomizeRotationDirection: 0 randomizeRotationDirection: 0
gravitySource: 0
maxNumParticles: 1000 maxNumParticles: 1000
customEmitterVelocity: {x: 0, y: 0, z: 0}
size3D: 0 size3D: 0
rotation3D: 0 rotation3D: 0
gravityModifier: gravityModifier:
@ -6300,6 +6394,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 3 m_NumAlphaKeys: 3
minGradient: minGradient:
@ -6329,6 +6424,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 3 m_NumAlphaKeys: 3
UVModule: UVModule:
@ -7097,6 +7193,62 @@ ParticleSystem:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
LifetimeByEmitterSpeedModule:
enabled: 0
m_Curve:
serializedVersion: 2
minMaxState: 1
scalar: 1
minScalar: 1
maxCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: -0.8
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0.2
inSlope: -0.8
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
minCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_Range: {x: 0, y: 1}
ForceModule: ForceModule:
enabled: 1 enabled: 1
x: x:
@ -8439,6 +8591,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -8468,24 +8621,26 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
range: {x: 0, y: 1.2} range: {x: 0, y: 1.2}
CollisionModule: CollisionModule:
enabled: 0 enabled: 0
serializedVersion: 3 serializedVersion: 4
type: 1 type: 1
collisionMode: 0 collisionMode: 0
colliderForce: 0 colliderForce: 0
multiplyColliderForceByParticleSize: 0 multiplyColliderForceByParticleSize: 0
multiplyColliderForceByParticleSpeed: 0 multiplyColliderForceByParticleSpeed: 0
multiplyColliderForceByCollisionAngle: 1 multiplyColliderForceByCollisionAngle: 1
plane0: {fileID: 0} m_Planes:
plane1: {fileID: 0} - {fileID: 0}
plane2: {fileID: 0} - {fileID: 0}
plane3: {fileID: 0} - {fileID: 0}
plane4: {fileID: 0} - {fileID: 0}
plane5: {fileID: 0} - {fileID: 0}
- {fileID: 0}
m_Dampen: m_Dampen:
serializedVersion: 2 serializedVersion: 2
minMaxState: 0 minMaxState: 0
@ -8659,17 +8814,20 @@ ParticleSystem:
interiorCollisions: 0 interiorCollisions: 0
TriggerModule: TriggerModule:
enabled: 0 enabled: 0
collisionShape0: {fileID: 0} serializedVersion: 2
collisionShape1: {fileID: 0}
collisionShape2: {fileID: 0}
collisionShape3: {fileID: 0}
collisionShape4: {fileID: 0}
collisionShape5: {fileID: 0}
inside: 1 inside: 1
outside: 0 outside: 0
enter: 0 enter: 0
exit: 0 exit: 0
colliderQueryMode: 0
radiusScale: 1 radiusScale: 1
primitives:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
SubModule: SubModule:
serializedVersion: 2 serializedVersion: 2
enabled: 0 enabled: 0
@ -8853,6 +9011,7 @@ ParticleSystem:
m_RotationOrder: 4 m_RotationOrder: 4
minVertexDistance: 0.2 minVertexDistance: 0.2
textureMode: 0 textureMode: 0
textureScale: {x: 1, y: 1}
ribbonCount: 1 ribbonCount: 1
shadowBias: 0.5 shadowBias: 0.5
worldSpace: 0 worldSpace: 0
@ -8895,6 +9054,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -8924,6 +9084,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
widthOverTrail: widthOverTrail:
@ -9011,6 +9172,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -9040,6 +9202,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
CustomDataModule: CustomDataModule:
@ -9078,6 +9241,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -9107,6 +9271,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
colorLabel0: Color colorLabel0: Color
@ -9360,6 +9525,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
minGradient: minGradient:
@ -9389,6 +9555,7 @@ ParticleSystem:
atime6: 0 atime6: 0
atime7: 0 atime7: 0
m_Mode: 0 m_Mode: 0
m_ColorSpace: -1
m_NumColorKeys: 2 m_NumColorKeys: 2
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
colorLabel1: Color colorLabel1: Color
@ -9620,10 +9787,12 @@ ParticleSystemRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 0 m_ReceiveShadows: 0
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 0 m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0 m_ReflectionProbeUsage: 0
m_RayTracingMode: 0 m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
@ -9650,6 +9819,7 @@ ParticleSystemRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_RenderMode: 0 m_RenderMode: 0
m_MeshDistribution: 0
m_SortMode: 1 m_SortMode: 1
m_MinParticleSize: 0 m_MinParticleSize: 0
m_MaxParticleSize: 50 m_MaxParticleSize: 50
@ -9662,13 +9832,21 @@ ParticleSystemRenderer:
m_RenderAlignment: 0 m_RenderAlignment: 0
m_Pivot: {x: 0, y: 0, z: 0} m_Pivot: {x: 0, y: 0, z: 0}
m_Flip: {x: 0, y: 0, z: 0} m_Flip: {x: 0, y: 0, z: 0}
m_UseCustomVertexStreams: 0
m_EnableGPUInstancing: 0 m_EnableGPUInstancing: 0
m_ApplyActiveColorSpace: 0 m_ApplyActiveColorSpace: 0
m_AllowRoll: 1 m_AllowRoll: 1
m_FreeformStretching: 0
m_RotateWithStretchDirection: 1
m_UseCustomVertexStreams: 0
m_VertexStreams: 0001030405 m_VertexStreams: 0001030405
m_UseCustomTrailVertexStreams: 0
m_TrailVertexStreams: 00010304
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
m_Mesh1: {fileID: 0} m_Mesh1: {fileID: 0}
m_Mesh2: {fileID: 0} m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0} m_Mesh3: {fileID: 0}
m_MeshWeighting: 1
m_MeshWeighting1: 1
m_MeshWeighting2: 1
m_MeshWeighting3: 1
m_MaskInteraction: 0 m_MaskInteraction: 0

View File

@ -23,7 +23,7 @@ public class HitFeedbackTestObjectBehavior : MonoBehaviour
[SerializeField] private float normalDrag = 0.1f; [SerializeField] private float normalDrag = 0.1f;
[SerializeField] private float maximumDrag = 0.3f; [SerializeField] private float maximumDrag = 0.3f;
[SerializeField] private float torqueDrag = 0.2f; [SerializeField] private float torqueDrag = 0.2f;
[SerializeField] private float tackleStunTime = 0.6f; [SerializeField] private float tackleStunTime = 2f;
// The time in Seconds the player is allowed to boost for // The time in Seconds the player is allowed to boost for
private Rigidbody body; private Rigidbody body;
private Vector3 currentGravity = new Vector3(); private Vector3 currentGravity = new Vector3();
@ -165,6 +165,11 @@ public class HitFeedbackTestObjectBehavior : MonoBehaviour
float colliderMass = collider.attachedRigidbody.mass; float colliderMass = collider.attachedRigidbody.mass;
body.AddForce(colliderVelocity.magnitude * tackleDirection * (colliderMass / body.mass), body.AddForce(colliderVelocity.magnitude * tackleDirection * (colliderMass / body.mass),
ForceMode.Acceleration); ForceMode.Acceleration);
Hit();
}
public void Hit()
{
UpdateTackleResponse(true); UpdateTackleResponse(true);
hitSound.PlayAudio(false); hitSound.PlayAudio(false);
Destruction(); Destruction();