Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[Released] DestroyIt - Cinematic Destruction System

Discussion in 'Assets and Asset Store' started by DeadlyAccurate, Jun 14, 2014.

  1. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    Thanks for the reply. I'd used Collision.Impulse in my prototype code before integrating DestroyIt. I just tried it then by replacing the impactDamage calculation in ProcessDestructibleCollision with:

    impactDamage = 0.0171f * collision.impulse.magnitude/Time.fixedDeltaTime;

    This almost precisely mirrors the results for the existing code for both direct and oblique impacts on objects without rigidbodies and with Destructible objects nested below rigid bodies while fixing the issue where both a rigidbody and a Destructible script are on the same object.

    I understand though that you need to be a little more cautious than me :)
     
  2. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    Hi p_hergott,

    It depends on your game and which third party package you're using. Is this the asset you're using: Third Person Cover Shooter? Let us know specifically which package you're using and we'll request a copy from the developer so we can see what would be involved in integrating it with DestroyIt.

    We've done several integration tutorials in the past. The general process is always the same, the difference is in how they are implemented.

    The basic principle is, you find the code in your character controller asset package that handles bullet impacts. Sometimes, it will have its own damage system that you can add DestroyIt checks to, and other times it just handles particle effects or bullet hole decals. Regardless, this is where you add the code to check the impacted object for our Destructible script, and if it exists, apply damage.

    Here's the code, it's only a few lines. But where to put this code depends on the specific asset package you're using.
    Code (CSharp):
    1. DestroyIt.Destructible destObj = objectHit.collider.gameObject.GetComponent<DestroyIt.Destructible>();
    2. if (destObj != null)
    3.     destObj.ApplyDamage(10); // apply 10 points of damage to object hit.
    I hope that helps, please let us know if you need more assistance in integrating DestroyIt.
     
  3. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    Perfect! Thank you for the feedback. We will still regression-test the change of course, but it sounds like you're not having any issues with the Collision.Impulse change.

    Just out of curiosity, why is 0.0171f being multiplied by the impulse over time? Is that the multiplier you needed to get similar damage numbers to what DestroyIt was giving before the change?

    Thanks again for the feedback and help!
     
  4. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    Yes, I'd set up a test environment with a variety of objects of different masses and angles to my firing position. In all cases that multiplier replicated the existing damage amount to within a fraction of a percent. So, with the exceptions noted above, your existing code appears to be returning a result which is already proportional to Collision.Impulse.

    I've come up against some other problems with using high speed projectiles:
    https://forum.unity.com/threads/col...-high-velocity-has-unexpected-results.553501/
    I think the collision solver is making direct positional displacements to stop colliders penetrating and by using high speed low mass projectiles I'm pushing it into uncharted territory. So I may end up doing some ray (segment) casting or using triggers after all.
     
    zangad likes this.
  5. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    I noticed that sometimes damaging my vehicles when they were travelling at speed would result in them almost stopping instantaneously. This lead to the discovery that destroyed prefabs never acquire the velocity of the Destructible object that spawned them. (Although they sometimes appear that they do since they are quickly accelerated from a standing start by collisions with the main vehicle) I've tracked this down to 2 causes.

    One is that Rigidbody in Destructible, and hence VelocityFixedUpdate, will only be set if the rigidbody is on the same object as the Destructible component. Thus I changed line 112 in Destructible.cs from:

    Rigidbody = GetComponent<Rigidbody>();
    to
    Rigidbody = GetComponentInParent<Rigidbody>();

    The other problem is that while debris copy the velocity of the old object the destroyed prefabs do not. So in ProcessDestruction in DestructionManager.cs just after the line that reads:

    GameObject newObj = ObjectPool.Instance.Spawn(destroyedPrefab, oldObj.PositionFixedUpdate, oldObj.RotationFixedUpdate, oldObj.GetInstanceID());
    I inserted the lines:
    Rigidbody [] rigidbodies = newObj.GetComponentsInChildren<Rigidbody>();
    for (int i = 0; i < rigidbodies.Length; i++)
    rigidbodies.velocity = oldObj.VelocityFixedUpdate;

    The destroyed prefabs now carry on with the old velocity as expected.

    Another change I've made is to make damage proportional to the square of relative velocity (ie proportional to kinetic energy rather than momentum.). This is probably a matter of taste but it works well for me as I found that without this I either had high velocity weapon fire barely scratching the vehicles or minor inter vehicle collisions causing instant wrecks.
     
    zangad likes this.
  6. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    Thanks for sharing your the results of your fixes. Good catch on the destroyed prefabs not inheriting old objects' velocity. I've put that on our to-do list to fix, and we'll add a new scenario in the main demo scene of DestroyIt to regression test it going forward.

    I think we didn't notice that because the way our destructible objects are setup - when they are destroyed, the parent object is just a container for the debris. But you're right, the parent prefab object should inherit velocity from the destroyed object.

    We'll also take a closer look at the damage calculations. I like the idea of adding more weight to kinetic energy rather than straight mass/velocity multipliers. I agree it's probably a personal preference, but I also think most customers would expect damage calculations to work this way. Thanks again for sharing how you applied your fixes. That helps a lot.
     
  7. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    I’ve been looking at pooling lately. I’m instantiating new destructible objects as my game progresses and thus none of them are around to be pooled (even though they are set to auto pool) when ObjectPool starts.

    Thus when InstantiateDebris is called there’s no PooledRigidbodies and DebrisRigidBodies gets set to null. And then none of the code under

    if (DebrisRigidbodies!=null)

    gets called which results in nothing being assigned to the debris layer and none of the parent velocities being copied to the debris. Hence my problem with velocity from the previous post which I fixed down the bottom of ProcessDestruction.

    I’ve now replaced that fix by removing the if (debrisRigidBodies != null) condition from InstantiateDebris and adding it to the start of the if (debrisRigidBodies.Length == 0) condition. The following code now actually gets called on my dynamic destructible objects and they are tagged as debris and have their velocities correctly set.

    Having done all this I’ve now realised that maxPersistentDebris simply deactivates debris but leaves the deactivated game objects in the scene. In my case this results in a rapid accumulation of deactivated objects and no effective pooling. It appears that the only built in mechanism to re-pool an object is to attach a Pool After script to it. Is that correct? It seems to be working for the BulletHit etc objects but I haven’t tried it as yet with my compound objects.
     
    zangad likes this.
  8. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    I just tried replacing
    debris.Disable()
    with
    ObjectPool.Instance.PoolObject(debris.GameObject, true);
    when ActiveDebrisCount > maxPersistentDebris

    Seems to work as expected (provided the prefab name been added to the object pool) and negates the need to add PoolAfter on my debris. Also PoolAfter wouldn't have coexisted well with excess debris being disabled as this would have disabled the PoolAfter update function and stopped them ever timing out and being added to the pool.
     
    zangad likes this.
  9. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    Hi RunSwimFly,

    We have Scenario #25 in our demo scene that instantiates a dynamic destructible object at runtime, and using that as test, I'm unable to reproduce the issue described. When I step through the code, it does populate the collection of debris rigidbodies and steps into the if (debrisRigidbodies != null) code.

    One thing that Scenario #25 is possibly doing differently is that it uses the DynamicDestructible.cs script to spawn in the destructible object. That was our solution to the pooling issue for dynamic objects created at runtime. I'm not sure if that would work for your game, just throwing it out there as the option we use to register dynamic destructible objects with the object pooler.
    Yes, you're correct, the debris gets disabled after it reaches the maxPersistentDebris threshold, but the objects don't get destroyed/re-pooled. The PoolAfter.cs script was provided as an option for resetting and re-pooling destroyed objects, but there is currently no system in place to automatically find and collect those disabled objects. We have a task on our backlog to do just that:
    I've bumped up the priority of this task, based on your feedback. At the time, I didn't like the idea of adding a bunch of "polling" scripts to the Update loop (one for each active destroyed object), but it sounds like the benefits might outweigh the added processing. It would definitely fix the accumulation of deactivated debris you described. Let me know what you think, we can tweak the proposed solution if there's a better option.
    If that solution works for your game, I would go with it. It's definitely more performant to use the existing threshold polling to re-pool a destroyed object than the method I mentioned above that introduces a polling script for each one. The only thing I can see is that method will sometimes re-pool an entire object that only has some of its debris disabled.

    For example, if you have a destroyed object with 10 pieces of debris in the scene, and 5 of the pieces get disabled because the maxPersistentDebris threshold is reached, then the entire object would be re-pooled and the remaining visible debris would disappear. We wanted to avoid this, as it might be jarring to the player. However, it might not matter for your game, especially if your debris threshold is high enough and the game is structured in a way that a player would never notice the older visible debris objects disappearing. If that's the case, then your method is preferable for performance. It really depends on how important it is in your game that debris never disappears while a player is looking at it.

    Hope that makes sense, please let me know if it doesn't. And thanks for your feedback, very good discussions! :)
     
  10. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    I don’t think the DynamicDestructible script is going to help me here. The dynamic objects I’m creating are entire vehicles, each with their own hierarchy of Destructible components.

    Thanks for the warning on my re-pooling solution. I’ll keep an eye out and adjust my solution if I see too much noticeable debris removal.

    Task #92 sounds like it would work well. I assume one would still need to manually add the destroyed prefabs and counts to Object pool in the inspector? Otherwise the debris would be destroyed rather than pooled.

    For my own purposes I’ve added a function to ObjectPool which will take a GameObject and then add all the destroyedPrefabs it finds in any Destructible children to the prefabsToPool list along with a suitable count. Then at the start of each level I run through my vehicle creation roster and call that function on each unique vehicle that I find.

    I’m enclosing all my additions in defines so I can compare them against the next iteration of the library and remove them if they are no longer needed. Enjoying the discussion as well :)
     
  11. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    I've been using the DestroyIt SUV model for testing and noticed that the debris seemed to be taking up more of the Physics FixedUpdate than I would have expected. When I profiled it I noticed that about half of the debris never went to sleep.

    As a test I tried dropping 100 copies of the SUV_Door_Back_DEST into my environment spaced such that they are only in contact with the terrain and not with each other. None of them went to sleep and they took up 15% of frame time.

    I tried disabling the two side colliders that border the window and all of the doors went to sleep and took up 3.9% of frame time. I then tried reenabling the side colliders but rescaling their Y dimension from 0.7 to 0.4 such that there was no overlap between any of the colliders and all but a few of the doors went to sleep and took 8% of frame time.

    It didn't make sense to me that colliders attached to the same rigidbody should be interfering with each other even if they overlapped but then I noticed that the z components of the child collider positions were all non zero and slightly different to each other. When I zeroed them and returned them to their original overlapping scale all the doors went to sleep and performance was the same as disabling the side colliders. So it appears that somehow the slight offset combined with the overlap was creating a geometry which never rested on the ground properly.

    I guess the moral, if there is one, is to test any compound collider objects and make sure they go to sleep. Not particularly important for your demo scene but certainly useful for me before I get any modelling done.
     
    Last edited: Sep 23, 2018
    zangad likes this.
  12. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    Wow, that's weird. Yeah, I was under the same assumption, that compound colliders would not interfere with each other in regards to rigidbody sleep thresholds. I never profiled that assumption, though. Very good find.

    I've added a to-do task for us to look at the compound colliders again and test the rigidbody sleep thresholds for the objects in our demo scenes. This should especially help with objects like the SUV and marble columns, which use compound colliders. We originally used mesh colliders for those complex objects, but noticed a big performance boost when switching to compound colliders. It sounds like if we zero out the transforms and scales on those colliders, we could possibly get another performance boost, especially when using mass/heavy destruction with lots of debris in the scene.

    Thank you for the detailed feedback! It's very appreciated.
     
  13. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    It is strange. I don't think there's any interaction between the colliders in a compound collider object. It's just that they can form a somewhat irregular shape that just just keeps jittering as it lies on the ground. It's easy enough to fix for things like the doors where, once they are aligned, the colliders will rest flat on the ground but there's no easy solution for objects like SUV_Quarter Panel Front Left_DEST etc where the colliders form a more complex shape which under some rotations will sit on an edge or a point.

    I've tried lifting the sleep threshold but, while the object's net movement is near zero, it's vibrating too rapidly to go to sleep for even quite large threshold values. I also tried playing around with the Default Contact Offset to try to cure the jitter but it had no discernible effect. I could perhaps script them to go to sleep if their movement over a given time period is sufficiently low but I'll wait until I have my own models and see if it's needed.

    I've lifted the mass of all the prefabs but that shouldn't be having an effect. I've also made the roof top a seperate destructible prefab and that was causing a problem with sleeping until I realised that the mesh was considerably offset from the transform centre and thus my newly introduced rigidbody was sitting outside of the collider for the object.

    I'll be interested to see what you find. I haven't been able to find anything online about compound colliders and sleeping or instability.
     
    Last edited: Sep 24, 2018
  14. RunSwimFly

    RunSwimFly

    Joined:
    Mar 2, 2011
    Posts:
    23
    Just wrote this and it seems to put the compound colliders I've tried it on to sleep nicely. It doesn't consider rotational motion in deciding whether to put an object to sleep but works well enough for my debris. Doubt it adds much overhead but for the moment I'm only attaching it to problem objects. I plucked the values for the constants out of the air. They can be tuned to taste.

    Code (CSharp):
    1. public class CheckSleep : MonoBehaviour {
    2.  
    3.     private Vector3 savedPos = Vector3.zero;
    4.     private int stationaryCount = 0;
    5.     const float distanceSquared = 0.2f;
    6.     const int maxCount = 20;
    7.  
    8.     void OnEnable()
    9.     {
    10.         stationaryCount = 0;
    11.     }
    12.  
    13.     void FixedUpdate () {
    14.         if ((transform.position-savedPos).sqrMagnitude<distanceSquared)
    15.         {
    16.             if (++stationaryCount>maxCount)
    17.             {
    18.                 GetComponent<Rigidbody>().Sleep();
    19.                 stationaryCount = 0;
    20.             }
    21.         }
    22.         else
    23.         {
    24.             savedPos = transform.position;
    25.             stationaryCount = 0;
    26.         }
    27.     }
    28. }
    29.  
     
  15. detvog

    detvog

    Joined:
    Dec 23, 2017
    Posts:
    1
    Hello,
    i work with the last invector and destroyit. The scripts vDestructibleCollider,vDestructible works for shooters goot, but i can not use the sword and the axe for destroy objects. Have anyone a script where i can use sword and axe too?
    Sorry for my bad english. I'am not good in english and i'am not a progammer.
     
  16. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    Did you see this video where we use Invector and DestroyIt with a sword?


    Does that still work? It's possible that Invector changed something and we need to update our instructions.
     
    ftejada likes this.
  17. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    Version 1.10 has been submitted to the asset store. The newest feature for DestroyIt: Destructible terrain trees!



    Now you can use Unity's terrain system to paint fully-destructible trees onto the terrain. It works with both Unity's tree system and SpeedTree.



    You can also find a PDF of written instructions here: http://www.modelshark.com/Content/DestroyIt-Destructible-Trees.pdf

    Another new feature is auto-deactivate, when you have thousands of destructible objects in the scene.


    NOTE: This is a major update! Please backup your project before importing!

    Changelog:

    Major Features
    • Support for destructible terrain trees.
    • New Auto-Activate feature on DestructionManager script allows you to have thousands of deactivated destructible objects in the scene and activate them when player is near.
    Unity Version
    • Updated DestroyIt to Unity 2018.3
    Enhancements/New Features
    • Blast effects (rocket, nuke, various explosions) now apply damage using both BlastForce and BlastDamage parameters instead of only BlastForce.
    • Rocket and Explode scripts modified so they have three blast radii - Point Blank, Near, and Far. You can adjust the damage and radii of all three.
    • Added new SpawnObject script to spawn particle effects directly from the object pool.
    • Improved the way AutoPooling works - Destructible scripts insert objects into the pool instead of the ObjectPool looking for Destructibles in the scene.
    • Implemented auto backup/restore process for terrainData tree changes in the Unity Editor if Unity crashes.
    • Implemented process to save destructible tree stand-ins to a hashed Resources path so you can manage destructible drees for multiple scenes without conflict.
    • Hit points of destructible objects can now have decimals.
    • New menu option Window -> DestroyIt -> Setup - First Person Controller adds a first person controller gameobject with camera and pre-configured weapons to your scene.
    • InputManager was moved from the GameManager to the FirstPersonController prefab.

    Particle Effects
    • Added LeafBulletHit, LeafParticleEffect, and LeafParticleEffectHeavy.
    • Updated all particle effects to use the 2018.3 particle shaders.
    Bug Fixes
    • Fixed DestroyIt Mobile shader to correct an error reported in the console, and to fix the progressive damage texture.
     
    Last edited: Jan 3, 2019
    GMax, ledbetterman and Arganth like this.
  18. teamkamakiri

    teamkamakiri

    Joined:
    Jun 24, 2017
    Posts:
    4
    After updating to the latest version, problems occurred when used with other assets. The menu bar does not update and an error appears in play mode.(No errors are displayed on the console)
    Unity 2018.2.20f1 & 2018.3.0f2
     
  19. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    Did you delete your old version of DestroyIt and import a fresh version? That may be the reason for the missing menu bar item.

    When you say an error appears in Play mode, can you clarify or provide a screenshot?
     
  20. teamkamakiri

    teamkamakiri

    Joined:
    Jun 24, 2017
    Posts:
    4
    If I install this asset and some other asset into an empty project, it will be in this state. It does not matter the order. Both assets are not updated in the menu bar display.
     

    Attached Files:

  21. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    Hi all,

    We recently had a couple questions about integrating DestroyIt with Opsive's Ultimate Character Controller. We had previously done a video tutorial for integrating DestroyIt with UFPS, but due to changes to UFPS Version 2 and Ultimate Character Controller, that video is now outdated.

    Anyway, long story short - the steps to integrate DestroyIt with the newer version of Opsive's controller are different, but actually easier now. UFPS version 2 exposes an OnObjectImpact event that your game objects can listen to and apply damage to the Destructible component as needed.

    I went through the process for making a crate destructible in Ultimate Character Controller/UFPS, and below are the steps, starting at the beginning.

    Steps:
    1) Create a new project
    2) Import Ultimate Character Controller and DestroyIt asset packages
    3) Open the Ultimate Character Controller UFPSDemo scene
    4) Copy the DamageOnImpact script (see below) into your project
    5) Choose an object in the demo scene (such as one of the crates) you want to be destructible
    6) Add the Destructible script to the crate, set its total hit points to 10
    7) Add the DamageOnImpact script to the crate
    8) From the top menu, choose Window -> DestroyIt -> Setup - Minimal
    9) Run the demo scene and shoot the destructible object with the rifle

    DamageOnImpact Script:
    Code (CSharp):
    1. using DestroyIt;
    2. using UnityEngine;
    3. using Opsive.UltimateCharacterController.Events;
    4.  
    5. public class DamageOnImpact : MonoBehaviour
    6. {
    7.    public void Awake()
    8.    {
    9.        EventHandler.RegisterEvent<float, Vector3, Vector3, GameObject, Collider>(gameObject, "OnObjectImpact", OnImpact);
    10.    }
    11.  
    12.    private void OnImpact(float amount, Vector3 position, Vector3 direction, GameObject attacker, Collider hitCollider)
    13.    {
    14.        Destructible destructible = hitCollider.GetComponentInParent<Destructible>();
    15.        if (destructible != null)
    16.            destructible.ApplyDamage(amount);
    17.      
    18.        Debug.Log(name + " hit by " + attacker.name + " for " + amount + " damage.");
    19.    }
    20.  
    21.    public void OnDestroy()
    22.    {
    23.        EventHandler.UnregisterEvent<float, Vector3, Vector3, GameObject, Collider>(gameObject, "OnObjectImpact", OnImpact);
    24.    }
    25. }
    Results:


    Hope that helps anyone looking to use DestroyIt with Opsive's Ultimate Character Controller (or other controllers - my understanding is they all use UFPS version 2).
     
  22. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    Over in the console, press the red stop-sign looking button on the far right. You're getting a compiler error, and if you press that button, it should tell you exactly what script it's in and what line number.
     
  23. teamkamakiri

    teamkamakiri

    Joined:
    Jun 24, 2017
    Posts:
    4
    I'm sorry, I seem to have erased the red button while I was not aware. There was an error.
    Assets/DestroyIt/Scripts/Managers/TreeManager.cs(215,31): error CS0117: `UnityEditor.PrefabUtility' does not contain a definition for `SaveAsPrefabAssetAndConnect'
     
  24. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    From your screenshot, it looks like you're using 2018.2. There were some significant changes to how prefabs work in Unity in 2018.3, and this error is caused by that. Can you try to import DestroyIt into 2018.3 and see if you're still getting compiler errors?
     
  25. teamkamakiri

    teamkamakiri

    Joined:
    Jun 24, 2017
    Posts:
    4
    The problem with 2018.3 has been solved. It was caused by importing the sample script"Bomb" introduced in the forums in the past. When deleting it, other errors disappeared.I apologize for the trouble.
     
  26. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    Glad you were able to get it to work!
     
  27. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    446
  28. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    I use Modo, but you can do it in Blender, 3DS Max, Maya, etc. We have a tutorial that can get you started on cell fracturing in Blender.


    If you want destruction like the way we did the SUV, or like many of the objects in our destructible asset packs, there's no easy way to do it, but the mesh slicing tools built into 3D modeling tools combined with particle effects can go a long way toward making good-looking destruction.

    Here's a free pack we made of destructible assets. https://assetstore.unity.com/packages/3d/characters/destructible-decoratives-119957

    I used cell fracturing for the vases and concrete objects and manually sliced the park bench. I added particle effects on destruction to fill them out when they get destroyed.
     
  29. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    446
    oh nice i missed that video when checking the channel, thanks for the tip.
     
  30. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    446
    in the end of the video you mentioned "grease pencil" which gives location specific shattering effects.

    But correct me if im wrong, at the end of the day, from blender you still just export a model composed of pieces.
    In unity, there won't be any special functionality regarding location or special types of fracturing or anything like that.

    All those extra cell fracture features that make things like wood chips and stuff are just fancy ways of slicing up a mesh right?


    Also a final question:
    When swapping to destroyed prefab, the Force applied is based purely on rigidbody interaction, so based on velocity and mass of interacting bullet, cannonball, etc.

    I'm making a VR melee game with a kinematic sword object, so I assume in theory i can do something cool like swinging at a destructible pillar and it will be destroyed with the destroyed pieces being impacted by the force of the sword swing?
     
  31. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    That's correct.

    I think what you want can be found with the FireAxe and the MeleeArea script in the demo scene. If that's not quite right, let us know, and we'll see if we can figure it out.
     
  32. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    446
    ok thanks.

    ooh one more question sorry:
    In VR theres a velocity based approach to holding an object, so it is a non kinematic object moved around with velocity.

    I saw in the demo how one pillar falling on top of another or a tree falling on top of the grouped structure causes damage. I assume this is based on the physics engine velocity and mass.

    So technically a velocity based VR controller can cause that same type of damage as well right, in a fully simulated type of way.
     
    Last edited: Jan 10, 2019
  33. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    We don't have any experience with VR, so it would be difficult to say with certainty. The cannonball might help you answer that. We tried to include most types of ways you can damage an object (explosion, hit scan, rigidbody, etc.) in our test scenario, but if there's something we're missing, we can look into adding it in a future release.
     
  34. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    446
    ok, thanks again, I'll experiment with it .
     
  35. luniac

    luniac

    Joined:
    Jan 12, 2011
    Posts:
    446
    Hey i was reading documentation and im confused about the difference between Hit Effects and TagIt.
    It seems like they do the same thing, which is to control particle effects on collision?
    TagIt seems to have a bit further functionality like 'power' tag.
     
  36. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    We needed to separate out the Hit Effects system from TagIt. TagIt still has some uses for things like power and destructible groups, but we use HitEffects for the particle collision effects.
     
    luniac likes this.
  37. tyapichu

    tyapichu

    Joined:
    Aug 11, 2013
    Posts:
    9
    Hello there, can you please help me? I'm trying to create something like animated pillar - a bone with flesh. I'm adding my bone to list of Debris to Re-Parent like in Re-Parenting sample and it works fine. Next i want my flesh to stay on bone like in Chip-Away Debris sample but it doesn't work as i expect. Flesh flies away like before and my bone also flies away. As i understand Chip-Away ignores Re-Parenting. It creates new separated debrises with rigidbodies... or i'm doing something wrong.
     
    Last edited: Jan 11, 2019 at 4:50 PM
  38. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    161
    Can you email us (modelsharkstudio@gmail.com) a link to your project (or a sample of it) so we can look at it?
     
  39. panders

    panders

    Joined:
    Apr 9, 2013
    Posts:
    4


    Is there a fix for the new Invector Shooter and Melee update 1.3? The DestructibleCollider.cs is broken in the lastest Invector update...

    Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/Generic/vDestructibleCollider.cs(2,16): error CS0234: The type or namespace name `EventSystems' does not exist in the namespace `Invector'. Are you missing an assembly reference?

    and

    Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/Generic/vDestructibleCollider.cs(12,53): error CS0246: The type or namespace name `vIDamageReceiver' could not be found. Are you missing `Invector' using directive?
     
  40. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    Hi panders,

    Here are the updated instructions for integrating DestroyIt with Invector Third Person Controller v1.3:

    Steps:
    1. Import DestroyIt into your Invector Third Person Controller project.
    2. Import the DestroyIt Scripts for Invector Third Person Controller 1v3 package.
    3. From the top menu in Unity, choose Window => DestroyIt => Setup Minimal.
    4. Add the Destructible script to an object you want to make destructible.
    5. Add the vDestructible script to the same object, and at the same level.
    6. Run the scene. You should be able to shoot the destructible object and destroy it.
    Example: (Cardboard Box)


    Runtime Results: (vShooterMeleeTopDown_DemoScene)
     
  41. panders

    panders

    Joined:
    Apr 9, 2013
    Posts:
    4
    So I need to go thru my entire project and add this by hand? I have made a lot of destructibles.... :(
     
  42. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    183
    No, all you need to do is import the new package (step 2).

    I provided the complete updated steps for all customers who would like to integrate Invector's TPC Controller with DestroyIt.
     
  43. panders

    panders

    Joined:
    Apr 9, 2013
    Posts:
    4
    YES!! as usual you guys rock. This was the least painful part of my middleware upgrade!
     
  44. xnooztvfr

    xnooztvfr

    Joined:
    Jul 31, 2013
    Posts:
    4
    Hello,

    How to integrate DestroyIT with Photon, because the cube disappears when I shoot on the cube.
    Your tutorial for Photon does not help me because I can't click on it but shoot well with my weapon on it.

    Can you help me please? :)