Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by moinchdog · Dec 28, 2012 at 04:37 AM · colliderterrainspherechildrentreeprototype

terrain tree children problem

i have a bunch of trigger sphere colliders set up as a child of the tree renderer. When i painted them onto the terrain the trigger colliders dont do what the script on them is telling them to do. I dont know if they re even there. Please help im really confused.

EDIT : This script is part of a dynamic fire pack. An editor script it comes with generates like 400 sphere collider each with the script below on it. When the fire object comes in contact with a collider it instantiates another fireobject. I dont think the children colliders are there when its parent tree is painted on the terrain.

 #pragma strict
 var fireParticle : Transform;
 var firePoints : Transform[]; //Fire particles will be created at these positions once alight.
 var fuel : float = 100.0; //The amount of fuel stored in this object. Fuel will burn out over time.
 var fuelConsumption : float = 30.0; //The amount of fuel consumed per second by the object.
 var fireSpread : float = 2.0; //The radius at which fire will spread
 var spreadTime : float = 3.0; //The time after which fire will spread
 var randomRange : float = 1.2; //The random maximum time after the spreadTime
 var fallOutC : float = .05; //The chance that a Fire Point will fall out after some burn time
 private var fireStarted : boolean = false;
 private var fireC : Transform[];
 private var count : int = 0;
 private var fTime : short = 0.0;
 private var fSpread : boolean = false;
 private var fellOut : boolean = false;
 private var bColor : boolean = false;
 private var spPos : Vector3 = Vector3.zero;
 
 function Update () 
 {
     if (fireStarted)
         {
             fuel -= fuelConsumption * Time.deltaTime;
             if ((Time.time - fTime) >= spreadTime && !fSpread)
                 {
                     spreadFire();
                     if (Random.value > .95 && transform.root && transform.root.renderer && !bColor)
                         bColor = true;
                 }
             if (!fellOut)
                 {
                     if (Random.value > 1-fallOutC)
                         fallOut();
                     fellOut = true;
                 }
         }
     if (fuel <= 0 && fireStarted)
         endFire();
     if (bColor)
         {
             var CL : Color = transform.root.renderer.material.color;
             CL.r -= .01 * Time.deltaTime;
             if (CL.r < .1)
                 {
                     CL.r = .1;
                     bColor = false;
                 }
             CL.g = CL.r;
             CL.b = CL.r;
             transform.root.renderer.material.color = CL;
         }
 }
 
 function startFire()
 {
     if (!fireStarted)
         {
             fireStarted = true;
             for (var all : Transform in firePoints)
                 {
                     var fire = Instantiate(fireParticle, all.position, Quaternion.identity);
                     fire.parent = transform;
                     fireC[count] = fire;
                     count++;
                 }
             fTime = Time.time;
         }
 }
 
 function endFire()
 {
     for (var all2 : Transform in fireC)
         {
             if (all2.particleEmitter)
                 all2.particleEmitter.emit = false;
             for (var child : Transform in all2)
                 if (child.particleEmitter)
                     child.particleEmitter.emit = false;
         }
     fireStarted = false;
     for (var all3 : Transform in firePoints)
         Destroy(all3.gameObject, 5);
     Destroy(this);
 }
 
 function Awake()
 {
     fireC = new Transform[firePoints.length];
     setWind();
 }
 
 function spreadFire()
 {
     fSpread = true;
     var InRange = Physics.OverlapSphere(spPos, fireSpread);
         for (var all : Collider in InRange)
             {
                 yield WaitForSeconds(Random.value * randomRange);
                 if (all.GetComponent("FirePoint"))
                     all.SendMessage("startFire");
             }
 }
 
 function fallOut()
 {
     transform.parent = null;
     rigidbody.useGravity = true;
 }
 
 function setWind()
 {
     yield WaitForSeconds(.1);
     switch (WindControl.windV)
         {
             case 0 : spPos = transform.position; break;
             case 1 : spPos = transform.position + Vector3(0, 0, fireSpread-(fireSpread/(1+(2 * (WindControl.windS+0.001))))); break;
             case 2 : spPos = transform.position - Vector3(fireSpread-(fireSpread/(1+(2 * (WindControl.windS+0.001)))), 0, 0); break;
             case 3 : spPos = transform.position + Vector3(fireSpread-(fireSpread/(1+(2 * (WindControl.windS+0.001)))), 0, 0); break;
             case 4 : spPos = transform.position - Vector3(0, 0, fireSpread-(fireSpread/(1+(2 * (WindControl.windS+0.001))))); break;
         }
 }
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image clunk47 · Dec 28, 2012 at 04:45 AM 0
Share

Please post the script you are using.

avatar image clunk47 · Dec 28, 2012 at 04:46 AM 0
Share

And PLEASE be much more specific.

avatar image moinchdog · Dec 28, 2012 at 08:55 AM 0
Share

ive updated my post but if anyone has a script for placing gameObjects at the location of tree prototypes??

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 4 - Sphere Falls through Terrain 2 Answers

Getting treePrototype information from RayCasting collisions onto terrain? 2 Answers

Terrain Tag OnControllerColliderHit not showing 0 Answers

Bucket with apples on a terrain (Sphere Colliders + Mesh Collider + Terrain) 0 Answers

How can I separate tree colliders from terrain colliders? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges