Guys I forgot to talk about something important ! You can of course slice the object again after they are sliced ! Simply set the layer of the new sliced object to the sliceable layer we've created ! :D
GameObject upperHull = hull.CreateUpperHull(target, crossSectionMaterial); SetupSlicedComponent(upperHull); upperHull.layer = target.layer; GameObject lowerHull = hull.CreateLowerHull(target, crossSectionMaterial); SetupSlicedComponent(lowerHull); lowerHull.layer = target.layer; this is how to enable it
I personally think that this kind of creative and immersive solution tutorials or optimization for vr are better. Because mostly thanks to you Valem we got lots of tutorials covering the basic systems. But not enough like this one. Much appreciated thanks
Really the best VR teacher of youtube. I don‘t know how but you really made me understand enough with your videos that i can now proudly say that my first game is near to the beta-test phase. Thank you Valem, with the beginning of next month, you‘ve got a new patreon! greetings from germany 🤘🏼
Haha I am working with EzySlice as well at the moment! Currently trying to make slicing colliders as well as mesh colliders are not great especially if the object has multiple different physics materials but one mesh.
Valem, Your vids are amazing! Thank you! Any suggestions on slicing children on the gameobject? Array, List, Loop or would it be too processor intensive?
Hi, thank you so much when child objects are sliced the new objects will appear far from the father there is the fix: on SlicedHull script newObject.transform.localPosition = original.transform.position;
what do you mean by newObject and original? i dont have that and also where does this go. sorry i know this is a late comment im having this issue where my sliceable is a child cause of the fruit model i downloaded and when i slice the pieces go FLYING
Curve slice might be hard because the procedural generation is not obvious with a curve :/ maybe youi can fake it by creating the curve using multiple linear curve
Hi Valem ! Could you do an update tutorial on the Pico4, especially for those who want to develop a PCVR game and have a Pico4 as hardware. Or do you have an idea on what should be the path to follow to achieve such thing ? I dont' want to make an apk build because it will not be playable by those who have a Rift S for example. Thanks!
Poking hole using mesh will be really computer heavy unfortunately. :/ But you can use stencil shader to create a "hole" mask and have something similar very easily. :) I made a mirror tutorial using stencil that used this technique.
The slice method is cutting through infinitely, not as per the size/scale of cutting plane, is there a way to limit the size of the cutting plane or control its limits so that only the part of a mesh that cuts through the plane (exact size of the cutting plane) gets cut instead of parts of the mesh cutting through the cutting plane as it is infinitely scaled. I am trying to cut through single mesh of a small city with some buildings, but the slice method is cutting though all the buildings which are above the cutting plane height instead of just cutting through the single building which is intersecting with the actual cutting plane.
Can you make a video con continous movement? I have trouble making it work. I uncheck snap turn and I still cant continuously turn. In fact I cant turn at all.
I have the slicing mechanic working perfectly but Unity is giving me errors about "Couldn't create a Convex Mesh from source mesh within the maximum polygons limit (256). The partial hull will be used. Consider simplifying your mesh". The gameObjects I have in the scene that I am cutting is only one capsule so I am not really understanding why that's happening. Sometimes after cutting, the hulls will also mysteriously disappear, so I'm really unsure what's wrong here. Can anyone help?
Add "using UnityEngine.XR.Interaction.Toolkit; to the header. Then, in the SetUpSlicedComponent function, add a line under the MeshCollider line: "XRGrabInteractable grabbable = slicedObject.AddComponent(); ->this should allow you to grab onto any of the hulls after they've been sliced. -- of course this will only work if you are either not using the layer mask, or if you make it possible to grab things on the "Sliceable" layer. If you've used the Direct Interactor Prefab in the controllers (for direct interactions), then select that and add both the "sliceable" and "default" layers to the Physics Interaction Mask list.
I should have talk about it in the video, but this is really based on the mesh complexity, if you're slicing boxes like in beat saber no worries on quest 2 but with thousand of triangles this can get worse as there is procedural mesh involved. :)
Hello, i have a problem, with static objects that i add everything works great, but if i want to slice animated object with the same properties and added componet this ist work at all, maybe you know how to set it up properly ?
i have a problem i cannot interact with sliceable object using the XR grab intractable i set my controllers to the sliceable layer and it did not help anyone know any fixes?
same - no errors - everything on the sliceable layer but nothing gets cut when I use my XR Grabbable. Did you ever figure out the issue? ChatGPT didn't see any errors either.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.InputSystem; using EzySlice; public class sliceObject : MonoBehaviour { public Transform startSlicePoint; public Transform endSlicePoint; public LayerMask sliceableLayer; public VelocityEstimator velocityEstimator; public Material croosSectionMaterial; public float cutForce = 200; // Start is called before the first frame update void Start() {
Guys I forgot to talk about something important ! You can of course slice the object again after they are sliced ! Simply set the layer of the new sliced object to the sliceable layer we've created ! :D
fyi slicedObject.layer = LayerMask.NameToLayer("Sliceable");
@@Headfelt in wich scrip should I put it in and where?
You could explain a way to cut if the sword is at a specific speed so you dont cut anything just with a touch
GameObject upperHull = hull.CreateUpperHull(target, crossSectionMaterial);
SetupSlicedComponent(upperHull);
upperHull.layer = target.layer;
GameObject lowerHull = hull.CreateLowerHull(target, crossSectionMaterial);
SetupSlicedComponent(lowerHull);
lowerHull.layer = target.layer;
this is how to enable it
Source code man
I personally think that this kind of creative and immersive solution tutorials or optimization for vr are better. Because mostly thanks to you Valem we got lots of tutorials covering the basic systems. But not enough like this one. Much appreciated thanks
This guy is a genius
Really the best VR teacher of youtube. I don‘t know how but you really made me understand enough with your videos that i can now proudly say that my first game is near to the beta-test phase. Thank you Valem, with the beginning of next month, you‘ve got a new patreon! greetings from germany 🤘🏼
Dankeschone Diavolo ! :D I'm glad I was able to help and feel free to link me your game once ready. :)
bro this is a cutting edge tutorial
Thanks I hope it slice up a good time :D
You're an absolute legend! Thank you for another great video!
I'm glad I was able to help and thank you for another donation Jostein you're the best
"Wake up babe! A new Valem tutorial just dropped."
Tu es la raison pourquoi je suis tellement motivé dans le dévelopemment de jeux VR sur Unity. Très bonne vidéo comme d'habitude, continue comme ça :)
et c'est des messages comme le tien qui me motive a continuer de faire des tutos merci à toi ! :)
Ah c'est pour ça cet accent Français, je me disais bien que ça sentait familier XDDD@@ValemTutorials
super tutoriel, merci !@@ValemTutorials
Thanks so much for the detailed tutorial, very helpful!
for those that can't get it to work with mesh you have to enable read write on the mesh in the assets
I have it on but still is not working
Was looking for a good slicing tutorial for a while so you saved me. Thanks!
finally someone !! Thank you sooo much!!!
Haha I am working with EzySlice as well at the moment! Currently trying to make slicing colliders as well as mesh colliders are not great especially if the object has multiple different physics materials but one mesh.
Wow, that valve code looks fancy. I used simply 2 positions with time.deltatime before.
I was currently making a beat saber clone so.. the timing of this tutorial is so perfect for me!! THANK YOU SO SO MUCH!! 💙💙💚💚❤❤💛💛
really nice tutorial, thank you, the only problem i had its if u let the slicer objct inside the mesh it cuts infinetely. But really nice toturial man
Amazing, thanks for sharing!
Like if you agree the best part of this video is hearing Quentin say “upper hull”
Valem, Your vids are amazing! Thank you! Any suggestions on slicing children on the gameobject? Array, List, Loop or would it be too processor intensive?
thanku
Thanks, ezy slice is still through all thoses years a great tool but what do you use to slice skinnedmesh renderers ?
Hi, thank you so much
when child objects are sliced the new objects will appear far from the father
there is the fix:
on SlicedHull script
newObject.transform.localPosition = original.transform.position;
OH GOD. THANKS YOU. Valem should pin this comment
what do you mean by newObject and original? i dont have that and also where does this go. sorry i know this is a late comment im having this issue where my sliceable is a child cause of the fruit model i downloaded and when i slice the pieces go FLYING
Hey valem ur tutorials are all amazing this cut is amazing try to make a tutorial of a soft mesh cut ,
Thankyou
Thanks Mohan ! :D But what's a soft mesh cut ?
@@ValemTutorials exactly like a surgical cut like how a surgeon cuts the skin during a surgery
is that even possible
Nice video and I was wondering how do I play my unity vr game on my oculus vr quest 2?
Nice tutorial, do you have any ideas about curve slicing in VR?
Curve slice might be hard because the procedural generation is not obvious with a curve :/ maybe youi can fake it by creating the curve using multiple linear curve
Can i slice animated objects?
Praise the Sun!
loverHull is indeed very lovely 😄
man I had so much trouble trying to say that word :D
I remember doing something like that in VR but it came packaged with a lot of warnings lol
Hi Valem ! Could you do an update tutorial on the Pico4, especially for those who want to develop a PCVR game and have a Pico4 as hardware. Or do you have an idea on what should be the path to follow to achieve such thing ? I dont' want to make an apk build because it will not be playable by those who have a Rift S for example.
Thanks!
Will this work for 3D humanoid models?
could you please do a tutorial on melee combati vr?
What about poking a hole through an object?
Poking hole using mesh will be really computer heavy unfortunately. :/ But you can use stencil shader to create a "hole" mask and have something similar very easily. :) I made a mirror tutorial using stencil that used this technique.
The slice method is cutting through infinitely, not as per the size/scale of cutting plane, is there a way to limit the size of the cutting plane or control its limits so that only the part of a mesh that cuts through the plane (exact size of the cutting plane) gets cut instead of parts of the mesh cutting through the cutting plane as it is infinitely scaled. I am trying to cut through single mesh of a small city with some buildings, but the slice method is cutting though all the buildings which are above the cutting plane height instead of just cutting through the single building which is intersecting with the actual cutting plane.
Can you double cut objects?
Yes just give the sliceable component to the spawned object and you can cut them again
Thank you so much!@@ValemTutorials
Can you make a video con continous movement? I have trouble making it work. I uncheck snap turn and I still cant continuously turn. In fact I cant turn at all.
I have the slicing mechanic working perfectly but Unity is giving me errors about "Couldn't create a Convex Mesh from source mesh within the maximum polygons limit (256). The partial hull will be used. Consider simplifying your mesh". The gameObjects I have in the scene that I am cutting is only one capsule so I am not really understanding why that's happening. Sometimes after cutting, the hulls will also mysteriously disappear, so I'm really unsure what's wrong here. Can anyone help?
how to add xr grab interactable to upper hall and lower hall so ican grab that?
Add "using UnityEngine.XR.Interaction.Toolkit; to the header. Then, in the SetUpSlicedComponent function, add a line under the MeshCollider line: "XRGrabInteractable grabbable = slicedObject.AddComponent(); ->this should allow you to grab onto any of the hulls after they've been sliced. -- of course this will only work if you are either not using the layer mask, or if you make it possible to grab things on the "Sliceable" layer. If you've used the Direct Interactor Prefab in the controllers (for direct interactions), then select that and add both the "sliceable" and "default" layers to the Physics Interaction Mask list.
you killed the homie suzanne
I have a problem. When I swing too fast sometimes it just go through cube without cutting it. Any idea how can I fix that?
How compute heavy is this ? Would it work okay on Quest 2 ? Thanks for the tutorial btw
I should have talk about it in the video, but this is really based on the mesh complexity, if you're slicing boxes like in beat saber no worries on quest 2 but with thousand of triangles this can get worse as there is procedural mesh involved. :)
Hello, i have a problem, with static objects that i add everything works great, but if i want to slice animated object with the same properties and added componet this ist work at all, maybe you know how to set it up properly ?
Have you found the answer to your question
i have a problem i cannot interact with sliceable object using the XR grab intractable i set my controllers to the sliceable layer and it did not help anyone know any fixes?
same - no errors - everything on the sliceable layer but nothing gets cut when I use my XR Grabbable. Did you ever figure out the issue? ChatGPT didn't see any errors either.
4:04 what's a lover hull? jk lol
idk why but it isn't slicing for me, no errors at all so I dont get it. It's just a cube I'm trying to slice nothing special
i also have this issue. the hasHit variable is never true in my case, so it never calls the slice method, did you find a fix?
apparently the linecast was too deep inside the collider of the cutting object, so it could never touch the slicable one.
MM
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using EzySlice;
public class sliceObject : MonoBehaviour
{
public Transform startSlicePoint;
public Transform endSlicePoint;
public LayerMask sliceableLayer;
public VelocityEstimator velocityEstimator;
public Material croosSectionMaterial;
public float cutForce = 200;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void FixedUpdate()
{
bool hasHit = Physics.Linecast(startSlicePoint.position, endSlicePoint.position, out RaycastHit hit, sliceableLayer);
if(hasHit)
{
GameObject target = hit.transform.gameObject;
Slice(target);
}
}
public void Slice(GameObject target)
{
Vector3 velocity = velocityEstimator.GetVelocityEstimate();
Vector3 planeNormal = Vector3.Cross(endSlicePoint.position - startSlicePoint.position, velocity);
planeNormal.Normalize();
SlicedHull hull = target.Slice(endSlicePoint.position, planeNormal);
if(hull != null)
{
GameObject upperHull = hull.CreateUpperHull(target, croosSectionMaterial);
SetupSlicedComponent(upperHull);
GameObject loverHull = hull.CreateLowerHull(target, croosSectionMaterial);
SetupSlicedComponent(loverHull);
Destroy(target);
}
}
public void SetupSlicedComponent(GameObject sliceObject)
{
Rigidbody rb = sliceObject.AddComponent();
MeshCollider collider = sliceObject.AddComponent();
collider.convex = true;
rb.AddExplosionForce(cutForce, sliceObject.transform.position, 1);
}
}
thank me later😀
Thanks❤🔥🙏
you sound like brackeys
Cut it out, man
This video is super choppy
@@beardordie5308 Yeah but I'm glad this video made the cut. :D
Wow... he sliced right through that illegal immigrant from africa...
Time to make metal gear rising VR.
Oh wait how do I rip the assets...