ignore collision between projectiles

This commit is contained in:
in0finite 2020-12-22 02:24:00 +01:00
parent 852b198ab1
commit f04728934e
8 changed files with 21 additions and 15 deletions

View file

@ -23342,6 +23342,9 @@ MonoBehaviour:
upwardsModifier: 2.5
radius: 10
explosionMultiplier: 1
layerMask:
serializedVersion: 2
m_Bits: 15105
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0

View file

@ -146,13 +146,13 @@ MonoBehaviour:
showPedSpeedometer: 1
groundFindingIgnoredLayerMask:
serializedVersion: 2
m_Bits: 14902
m_Bits: 31286
cameraDistanceFromPed: 4
minCameraDistanceFromPed: 2
maxCameraDistanceFromPed: 30
cameraRaycastIgnoredLayerMask:
serializedVersion: 2
m_Bits: 15158
m_Bits: 31542
legAndArmDamageMultiplier: 0.8
stomachAndChestDamageMultiplier: 1
headDamageMultiplier: 4

View file

@ -11,7 +11,7 @@ GameObject:
- component: {fileID: 7991730905356042406}
- component: {fileID: 8654847074425390642}
- component: {fileID: 1859652892926530849}
m_Layer: 0
m_Layer: 14
m_Name: Model
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -4594,7 +4594,7 @@ GameObject:
- component: {fileID: 223436154079187918}
- component: {fileID: 5633959673307472571}
- component: {fileID: 1740834482409443228}
m_Layer: 0
m_Layer: 14
m_Name: Projectile
m_TagString: Untagged
m_Icon: {fileID: 0}
@ -4632,9 +4632,6 @@ MonoBehaviour:
explosionDamageAmount: 1500
explosionDamageRadius: 7
particleSystemMultiplier: 1
collisionLayerMask:
serializedVersion: 2
m_Bits: 4294967295
speed: 15
rotationSpeed: 720
lifeTime: 20

View file

@ -23342,6 +23342,9 @@ MonoBehaviour:
upwardsModifier: 2.5
radius: 10
explosionMultiplier: 1
layerMask:
serializedVersion: 2
m_Bits: 15105
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0

View file

@ -15,7 +15,6 @@ namespace SanAndreasUnity.Behaviours
public float explosionDamageAmount = 1000;
public float explosionDamageRadius = 5;
public float particleSystemMultiplier = 1;
public LayerMask collisionLayerMask;
public float speed = 10;
public float rotationSpeed = 180;
public float lifeTime = 30;
@ -46,7 +45,12 @@ namespace SanAndreasUnity.Behaviours
if (shooterPed != null)
{
Physics.IgnoreCollision(shooterPed.characterController, projectile.GetComponentOrThrow<Collider>());
var projectileCollider = projectile.GetComponentOrThrow<Collider>();
var pedColliders = shooterPed.GetComponentsInChildren<Collider>();
foreach (var pedCollider in pedColliders)
{
Physics.IgnoreCollision(pedCollider, projectileCollider);
}
}
if (model != null)
@ -80,9 +84,6 @@ namespace SanAndreasUnity.Behaviours
if (m_alreadyExploded)
return;
if (((1 << other.gameObject.layer) & this.collisionLayerMask.value) == 0)
return;
m_alreadyExploded = true;
Object.Destroy(this.gameObject);

View file

@ -11,6 +11,7 @@ namespace SanAndreasUnity.Utilities
public float upwardsModifier = 1f;
public float radius = 10f;
public float explosionMultiplier = 1f;
public LayerMask layerMask;
private IEnumerator Start()
@ -22,7 +23,7 @@ namespace SanAndreasUnity.Utilities
float multiplier = this.explosionMultiplier;
float r = radius * multiplier;
var cols = Physics.OverlapSphere(this.transform.position, r);
var cols = Physics.OverlapSphere(this.transform.position, r, layerMask);
var rigidbodies = new Dictionary<Rigidbody, List<Collider>>();
foreach (var col in cols)

View file

@ -17,7 +17,7 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffcfffffffcfffffffcfffffffffffffffcfffffffcfffffffffffffffffffffffcfffffffc7ffffffcfffffffcdffffc8c0ffffc8c0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: ffcfffffffcfffffffcfffffffffffffffcfffffffcfffffffffffffffffffffffcfffffff87ffffffcfffffff8dffffc8c0ffffc8c0ffffffb5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 1
m_ReuseCollisionCallbacks: 0

View file

@ -6,6 +6,7 @@ TagManager:
tags:
- Minimap
- UI
- Fire
layers:
- Default
- TransparentFX
@ -21,7 +22,7 @@ TagManager:
- Player
- PedBone
- VehicleMesh
-
- Projectile
-
-
-