How do I for unique explosion

Get help using Construct 2

Post » Wed May 27, 2015 4:53 pm

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.
B
14
S
2
Posts: 66
Reputation: 776

Post » Wed May 27, 2015 4:59 pm

Do you understand what I want ?
I want whatever it will be an array that are within a circle of radius x objects .
B
14
S
2
Posts: 66
Reputation: 776

Post » Wed May 27, 2015 5:54 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed May 27, 2015 10:58 pm

And if the objects are not in the family ?
This piece of code I want to achieve :

Code: Select all
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);
           
        }
    }
}
B
14
S
2
Posts: 66
Reputation: 776

Post » Thu May 28, 2015 8:10 am

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Cub3D, David181 and 18 guests