davidarayan / ezyslice-example-scenes Goto Github PK
View Code? Open in Web Editor NEWExample Scenes in Unity3D Game Engine using EzySlice framework
License: MIT License
Example Scenes in Unity3D Game Engine using EzySlice framework
License: MIT License
Hi,
I am getting an error that says the Deterministic compilation has failed.
I can't seem to get the example code to work.
All I did was download it extract it and open it in unity using the required version.
Hi there, very nice solution. I was playing a bit and improved your example for RuntimeShatterExample. Now this new example would shatter all child objects many times to the sand gains or as much as Unity can handle when player clicks random shatter button :)
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using EzySlice;
public class RuntimeShatterRecursive : MonoBehaviour {
public List<GameObject> objectsToShatter;
public Material crossSectionMaterial;
public GameObject[] ShatterObject(GameObject obj, Material crossSectionMaterial = null) {
return obj.SliceInstantiate(GetRandomPlane(obj.transform.position, obj.transform.localScale),
new TextureRegion(0.0f, 0.0f, 1.0f, 1.0f),
crossSectionMaterial);
}
public EzySlice.Plane GetRandomPlane(Vector3 positionOffset, Vector3 scaleOffset) {
Vector3 randomPosition = Random.insideUnitSphere;
Vector3 randomDirection = Random.insideUnitSphere.normalized;
return new EzySlice.Plane(randomPosition, randomDirection);
}
public void RandomShatter() {
List<GameObject> adders = new List<GameObject>();
List<GameObject> removals = new List<GameObject>();
foreach(GameObject objectToShatter in objectsToShatter) {
GameObject[] shatters = RandomShatterSingle(objectToShatter);
if(shatters != null){
foreach(GameObject add in shatters){
adders.Add(add);
}
removals.Add(objectToShatter);
}
}
foreach(GameObject rem in removals){
objectsToShatter.Remove(rem);
}
foreach(GameObject add in adders){
objectsToShatter.Add(add);
}
}
public GameObject[] RandomShatterSingle(GameObject objectToShatter) {
GameObject[] shatters = ShatterObject(objectToShatter, crossSectionMaterial);
if (shatters != null && shatters.Length > 0) {
objectToShatter.SetActive(false);
// add rigidbodies and colliders
foreach (GameObject shatteredObject in shatters) {
shatteredObject.AddComponent<MeshCollider>().convex = true;
shatteredObject.AddComponent<Rigidbody>();
}
}
return shatters;
}
}
`
hi , your sample crash on my computer.
I have Macbook pro with Sierra and i use Unity 2017.1.0
Regards
Hi,
i want to report a bug : if object we want to cut has different localscale on axis ,
for example localscale = new Vector3 ( 0.5 , 1 , 3) ; (0 .5 # 3 # 1) , the sliced face is on wrong direction.
If localscale of them is equal , everything works fine
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.