Esempio n. 1
0
        protected ImpactTagMask?getOtherObjectTagMask(IImpactObject impactObject, Vector3 point, int otherPhysicsMaterialID, bool hasOtherObject)
        {
            if (hasOtherObject)
            {
                IImpactMaterial m = impactObject.GetPrimaryMaterial(point);

                if (m != null)
                {
                    return(m.MaterialTagsMask);
                }
                else if (ImpactManagerInstance.UseMaterialMapping && ImpactManagerInstance.TryGetImpactMaterialFromMapping(otherPhysicsMaterialID, out m))
                {
                    return(m.MaterialTagsMask);
                }
            }
            else
            {
                IImpactMaterial m;
                if (ImpactManagerInstance.UseMaterialMapping && ImpactManagerInstance.TryGetImpactMaterialFromMapping(otherPhysicsMaterialID, out m))
                {
                    return(m.MaterialTagsMask);
                }
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Process interaction data using the given Impact Object. The primary material at the interaction point will be used.
        /// </summary>
        /// <param name="interactionData">The interaction data to process.</param>
        /// <param name="impactObject">The Impact Object that the primary Impact Material will be retrieved from.</param>
        public static void ProcessInteraction <T>(T interactionData, IImpactObject impactObject) where T : IInteractionData
        {
            if (impactObject == null)
            {
                return;
            }

            ProcessInteraction(interactionData, impactObject.GetPrimaryMaterial(interactionData.Point), impactObject);
        }
        private static void triggerOnRaycastingObject <T>(T interactionData, IImpactObject impactObject, IImpactObject otherObject, int physicsMaterialId, bool useMaterialComposition) where T : IInteractionData
        {
            if (otherObject != null)
            {
                if (useMaterialComposition)
                {
                    int count = otherObject.GetMaterialCompositionNonAlloc(interactionData.Point, ImpactManagerInstance.MaterialCompositionBuffer);
                    for (int i = 0; i < count; i++)
                    {
                        ImpactMaterialComposition comp = ImpactManagerInstance.MaterialCompositionBuffer[i];
                        if (comp.CompositionValue > 0)
                        {
                            IInteractionData newInteractionData = interactionData.Clone();
                            newInteractionData.CompositionValue = comp.CompositionValue;
                            newInteractionData.TagMask          = comp.Material.MaterialTagsMask;
                            ImpactManagerInstance.ProcessInteraction(newInteractionData, impactObject);
                        }
                    }
                }
                else
                {
                    IImpactMaterial material = otherObject.GetPrimaryMaterial(interactionData.Point);
                    if (material != null || (ImpactManagerInstance.UseMaterialMapping && ImpactManagerInstance.TryGetImpactMaterialFromMapping(physicsMaterialId, out material)))
                    {
                        interactionData.TagMask = material.MaterialTagsMask;
                    }

                    ImpactManagerInstance.ProcessInteraction(interactionData, impactObject);
                }
            }
            else if (ImpactManagerInstance.UseMaterialMapping)
            {
                IImpactMaterial material;
                if (ImpactManagerInstance.TryGetImpactMaterialFromMapping(physicsMaterialId, out material))
                {
                    interactionData.TagMask = material.MaterialTagsMask;
                }

                ImpactManagerInstance.ProcessInteraction(interactionData, impactObject);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Process a continuous interaction using the interaction data and the given Impact Object. The primary material at the interaction point will be used.
 /// </summary>
 /// <param name="interactionData">The interaction data to process.</param>
 /// <param name="impactObject">The Impact Object that an Impact Material will be retrieved from.</param>
 public void ProcessContinuousInteraction <T>(T interactionData, IImpactObject impactObject) where T : IInteractionData
 {
     ProcessContinuousInteraction(interactionData, impactObject.GetPrimaryMaterial(interactionData.Point), impactObject);
 }
Esempio n. 5
0
        /// <summary>
        /// Process a continuous interaction using the interaction data and the given Impact Object. The primary material at the interaction point will be used.
        /// </summary>
        /// <param name="interactionData">The interaction data to process.</param>
        /// <param name="impactObject">The Impact Object that an Impact Material will be retrieved from.</param>
        public static void ProcessContinuousInteraction <T>(T interactionData, IImpactObject impactObject) where T : IInteractionData
        {
            ImpactManager instance = GetInstance();

            instance.ProcessContinuousInteraction(interactionData, impactObject.GetPrimaryMaterial(interactionData.Point), impactObject);
        }