How do I for unique explosion

0 favourites
  • 5 posts
From the Asset Store
High quality sound effect pack, in the following categories: explosion
  • One x beam inside a circle can be found all to put an object into a array,how?

    Let the strength of the explosion have an effect on the objects x beam inside a circle.

    It x beam I want to store the reference of objects which can be found inside a circle away into a array in order to be allowed to estimate their direction with his separate one next. That direction where they have to fly away due to the strength what the explosion creates.

  • Do you understand what I want ?

    I want whatever it will be an array that are within a circle of radius x objects .

  • Why do you want to put objects in an array?

    Would you like to put their UID's in an array or?

    If all objects are in a family, you could probably use something like:

    for each family

    system compare two values distance(family.x,family.y,explosion.x,explosion.y) < 150

    • array push family.uid

    But if you only want the distance to have effect on the objects, there would be no need for an array..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • And if the objects are not in the family ?

    This piece of code I want to achieve :

    using UnityEngine;
    using System.Collections;
    
    // Applies an explosion force to all nearby rigidbodies
    public class ExampleClass : MonoBehaviour {
        public float radius = 5.0F;
        public float power = 10.0F;
        
        // initializations or run code once.
        void Start() {
            Vector3 explosionPos = transform.position;
            Collider[] colliders = Physics.OverlapSphere(explosionPos, radius);
            foreach (Collider hit in colliders) {
                Rigidbody rb = hit.GetComponent<Rigidbody>();
                
                if (rb != null)
                    rb.AddExplosionForce(power, explosionPos, radius, 3.0F);
                
            }
        }
    }[/code:3jsjzfx9]
  • That is code from unity..

    You don't want to achieve that code, you want to achieve the effect that code has on objects..

    If you don't have family you'll just have to pick all the objects within that distance..

    So you'd have to have an event for all objects you want to affect that could possibly be within the area..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)