ignore collision between shooter ped and projectile

This commit is contained in:
in0finite 2020-12-21 02:10:17 +01:00
parent ec89abedd8
commit 1ca4b2d0ad
2 changed files with 12 additions and 2 deletions

View file

@ -23,7 +23,12 @@ namespace SanAndreasUnity.Behaviours
public static Projectile Create(
GameObject prefab, Vector3 position, Quaternion rotation, AudioClip audioClip, Geometry.GeometryParts model)
GameObject prefab,
Vector3 position,
Quaternion rotation,
AudioClip audioClip,
Geometry.GeometryParts model,
Ped shooterPed)
{
var go = Instantiate(prefab, position, rotation);
@ -35,6 +40,11 @@ namespace SanAndreasUnity.Behaviours
projectile.m_audioSource.Play();
}
if (shooterPed != null)
{
Physics.IgnoreCollision(shooterPed.characterController, projectile.GetComponentOrThrow<Collider>());
}
if (model != null)
{
model.AttachFrames(projectile.m_modelAttachTransform, MaterialFlags.Default);

View file

@ -651,7 +651,7 @@ namespace SanAndreasUnity.Behaviours
if (this.FiresProjectile)
{
Projectile.Create(this.ProjectilePrefab, firePos, Quaternion.LookRotation(fireDir), null, m_projectileModel);
Projectile.Create(this.ProjectilePrefab, firePos, Quaternion.LookRotation(fireDir), null, m_projectileModel, m_ped);
return;
}