Exemple #1
0
        public void OnContactNotify(ContactPair pair, ContactPairFlags events)
        {
            Vector3 position = Vector3.ZERO;

            if (pair.ActorFirst.IsDynamic)
            {
                position = pair.ActorFirst.GlobalPosition;
            }
            else if (pair.ActorSecond.IsDynamic)
            {
                position = pair.ActorSecond.GlobalPosition;
            }

            float volume = pair.SumNormalForce.Length / 1000.0f;

            if (volume > 1.0f)
            {
                volume = 1.0f;
            }

            if (volume > 0.0f)
            {
                EntityWorldEntity node1 = pair.ActorFirst.UserData as EntityWorldEntity;
                EntityWorldEntity node2 = pair.ActorSecond.UserData as EntityWorldEntity;

                if (node1 != null)
                {
                    Engine.Sound.Play3D(node1.CollisionSound, position, volume);
                }

                if (node2 != null)
                {
                    Engine.Sound.Play3D(node2.CollisionSound, position, volume);
                }
            }
        }
 public void SetActorPairFlags(Actor actor1, Actor actor2, ContactPairFlags flags)
 {
     this.scene.ActorPairFlags[actor1, actor2] = flags;
 }
        public void OnContactNotify(ContactPair pair, ContactPairFlags events)
        {
            Vector3 position = Vector3.ZERO;

            if (pair.ActorFirst.IsDynamic)
                position = pair.ActorFirst.GlobalPosition;
            else if (pair.ActorSecond.IsDynamic)
                position = pair.ActorSecond.GlobalPosition;

            float volume = pair.SumNormalForce.Length / 1000.0f;

            if (volume > 1.0f)
                volume = 1.0f;

            if (volume > 0.0f)
            {
                EntityWorldEntity node1 = pair.ActorFirst.UserData as EntityWorldEntity;
                EntityWorldEntity node2 = pair.ActorSecond.UserData as EntityWorldEntity;

                if (node1 != null)
                    Engine.Sound.Play3D(node1.CollisionSound, position, volume);

                if (node2 != null)
                    Engine.Sound.Play3D(node2.CollisionSound, position, volume);
            }
        }
Exemple #4
0
 public void SetActorPairFlags(Actor actor1, Actor actor2, ContactPairFlags flags)
 {
     this.scene.ActorPairFlags[actor1, actor2] = flags;
 }