|
Post by rocco on Dec 9, 2017 20:47:35 GMT
hey ..
with this addon you can cut down trees or whatever you want .. is not the best but it works..
take your tree and attach the following: 1- a Collider (Box or Capsule) 2- Rigidbody 3- ChopTree script 4- Tag to Enemy
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Invector;
using Invector.CharacterController;
public class ChopTree : vCharacterStandalone
{
public int speed = 4;
public GameObject logs;
public GameObject fruit;
public GameObject thisTree;
public int spawnNumFruit;
public int spawnNumLogs;
public int timeToWait = 7;
// Use this for initialization
void Awake()
{
thisTree = this.gameObject;
thisTree.GetComponent<Rigidbody>().isKinematic = true;
}
// Update is called once per frame
void Update()
{
if (currentHealth <= 0)
{
thisTree.GetComponent<Rigidbody>().isKinematic = false;
thisTree.GetComponent<Rigidbody>().AddForce(transform.up * speed);
DestroyTree();
}
}
public void DestroyTree()
{
StartCoroutine(TreeToGroundWait());
}
void Spawn()
{
for (int i = 0; i < spawnNumFruit; i++)
{
Vector3 fruitPos = new Vector3(this.transform.position.x + Random.Range(-1.0f, 1.0f), this.transform.position.y + Random.Range(0.0f, 2.0f), this.transform.position.z + Random.Range(-1.0f, 1.0f));
Instantiate(fruit, fruitPos, Quaternion.identity);
}
for (int i = 0; i < spawnNumLogs; i++)
{
Vector3 logsPos = new Vector3(this.transform.position.x + Random.Range(-1.0f, 1.0f), this.transform.position.y + Random.Range(0.0f, 2.0f), this.transform.position.z + Random.Range(-1.0f, 1.0f));
Instantiate(logs, logsPos, Quaternion.identity);
}
}
IEnumerator TreeToGroundWait()
{
yield return new WaitForSeconds(timeToWait);
Destroy(thisTree);
Spawn();
}
}
|
|
|
Post by kajamaz on Dec 10, 2017 16:53:25 GMT
Really interested in trying this out!
|
|
|
Post by rocco on Dec 10, 2017 16:56:41 GMT
Really interested in trying this out! Try it .. It works for me
|
|
|
Post by Legion on Dec 11, 2017 6:03:54 GMT
Very interesting, added to bookmarks to test it as soon as possible, thank you!
|
|
|
Post by tharindu on Dec 11, 2017 9:18:44 GMT
It's an awesome addon .
But the real problem is how practical it is when there's a large number of trees. If you were to create a survival game with this, you would want this to work with all your trees in the environment. If you use speedtrees and a unity terrain, you're literally screwed.
I use vegetation studio to get the trees. It has a feature called persistent storage where you are able to bake your trees into gameobjects individually. Then you can work with it, but of course, for a quicker solution, this is the way to go.
|
|
|
Post by rocco on Dec 11, 2017 9:46:13 GMT
It's an awesome addon . But the real problem is how practical it is when there's a large number of trees. If you were to create a survival game with this, you would want this to work with all your trees in the environment. If you use speedtrees and a unity terrain, you're literally screwed. I use vegetation studio to get the trees. It has a feature called persistent storage where you are able to bake your trees into gameobjects individually. Then you can work with it, but of course, for a quicker solution, this is the way to go. I work with gaia and gena .. The spawnen the trees only when I come in the vicinity ..
|
|
|
Post by rocco on Dec 11, 2017 9:47:07 GMT
Very interesting, added to bookmarks to test it as soon as possible, thank you! Not for that .. You're welcome
|
|
|
Post by tharindu on Dec 11, 2017 10:49:56 GMT
It's an awesome addon . But the real problem is how practical it is when there's a large number of trees. If you were to create a survival game with this, you would want this to work with all your trees in the environment. If you use speedtrees and a unity terrain, you're literally screwed. I use vegetation studio to get the trees. It has a feature called persistent storage where you are able to bake your trees into gameobjects individually. Then you can work with it, but of course, for a quicker solution, this is the way to go. I work with gaia and gena .. The spawnen the trees only when I come in the vicinity .. Nice, me too mostly. The developer (Lennart Johansen) is actually working with Adam Goodrich on an integration with Gena directly to the Vegetation Studio's persistent storage. So the entire set of trees/plants spawned with Gena (speedtrees or trees used with CTI from Lars Betram) will be accessible as individual game objects through VS. Including their colliders, transforms blah blah. See videos below. Already got a tree-chopping example embedded in the Vegetation Studio's demoscene which is cool.
|
|
|
Post by rocco on Dec 11, 2017 11:15:40 GMT
@ tharinduoh that looks good .. I'm still trying that depending on the impact of a certain Holzmänge directly into the inventory wanders .. unfortunately I do not get it .. I still use inventory pro ..
|
|
|
Post by tharindu on Dec 11, 2017 11:21:31 GMT
@ tharinduoh that looks good .. I'm still trying that depending on the impact of a certain Holzmänge directly into the inventory wanders .. unfortunately I do not get it .. I still use inventory pro .. I have never used inventory pro so far to be honest. Been happy with invector's item manager and I now I am pro at extending it haha xD Well let me know what sort of thing you would like to see in the invector item manager from inventory pro. Guess I could extend the item manager a bit more to do similar functionality to inventory pro. I am already working on banks for the RPG pack.
|
|
|
Post by rocco on Dec 11, 2017 11:27:22 GMT
@ tharinduoh that looks good .. I'm still trying that depending on the impact of a certain Holzmänge directly into the inventory wanders .. unfortunately I do not get it .. I still use inventory pro .. I have never used inventory pro so far to be honest. Been happy with invector's item manager and I now I am pro at extending it haha xD Well let me know what sort of thing you would like to see in the invector item manager from inventory pro. Guess I could extend the item manager a bit more to do similar functionality to inventory pro. I am already working on banks for the RPG pack. inventory pro is not bad .. i do a survival game .. with crafting and character equipment .. with accumulate resources and so on
|
|
|
Post by liquidsilkstudios on Jun 12, 2018 13:10:36 GMT
I work with gaia and gena .. The spawnen the trees only when I come in the vicinity .. Nice, me too mostly. The developer (Lennart Johansen) is actually working with Adam Goodrich on an integration with Gena directly to the Vegetation Studio's persistent storage. So the entire set of trees/plants spawned with Gena (speedtrees or trees used with CTI from Lars Betram) will be accessible as individual game objects through VS. Including their colliders, transforms blah blah. See videos below. Already got a tree-chopping example embedded in the Vegetation Studio's demoscene which is cool. I have Gaia and Vegetation Studio as well. Have you simply applied the script to the tree game object, then dropped the game object into VS, to spawn across the map? I am preparing to start working on this now and I just want to be sure.
|
|
|
Post by tharindu on Jun 13, 2018 21:54:17 GMT
Nice, me too mostly. The developer (Lennart Johansen) is actually working with Adam Goodrich on an integration with Gena directly to the Vegetation Studio's persistent storage. So the entire set of trees/plants spawned with Gena (speedtrees or trees used with CTI from Lars Betram) will be accessible as individual game objects through VS. Including their colliders, transforms blah blah. See videos below. Already got a tree-chopping example embedded in the Vegetation Studio's demoscene which is cool. I have Gaia and Vegetation Studio as well. Have you simply applied the script to the tree game object, then dropped the game object into VS, to spawn across the map? I am preparing to start working on this now and I just want to be sure. Yep.
|
|
|
Post by magicbanana on Jul 16, 2018 4:55:05 GMT
|
|