Search Unity

Dynamic RayCast System - C# Jobs upgrade is available !

Discussion in 'Assets and Asset Store' started by Vagabond_, Aug 27, 2014.

  1. Caronte3D

    Caronte3D

    Joined:
    Sep 16, 2014
    Posts:
    43
    Ok, thanks ;)
     
  2. mcurtiss

    mcurtiss

    Joined:
    Nov 29, 2012
    Posts:
    26
    Hey there! Interesting tool.

    Eventually I'm going to need to offload my continuous-space pathfinding algorithm to alternate threads. The algorithm throws 2D circlecasts against 2D obstacles of different shapes to trace a path around them (inspired by this). AFAIK, this is a pretty standard method that modern RTS-style games (like DOTA) use. At some point I was planning on writing my own custom circle/raycasting solution so that I could remove the logic from the main thread, but am willing to buy someone else's asset to get it all done more quickly. I was looking through your docs and didn't see support for 2D, but I suspect it would be a relatively simple matter to have a 2D version of your asset, and maybe you might expand the potential customer base.
     
    Last edited: Feb 17, 2017
  3. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, thanks you for suggestion. Honestly i do not think there will be any support for 2D objects coming at all.
    Only additional options and features will be added to the current state.
     
  4. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, just wanted to show a new feature i am working on. I need to put some more effort on it before release though...
    Custom LODs - this should replace the old LOD mesh feature which gives you only one available LOD mesh !

    This should be available in v1.70 and it is not available in v 1.61 !

    DRCS_Custom_LODS.png
     
    ZJP likes this.
  5. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hey guys some further work has been done on custom LODs. A few more thing need to be implemented and DRCS will be updated to v1.70 .

    DRCSLODs.png
     
  6. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys, DRCS is on sale now with 30% discount ...
     
  7. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    ah not anymore on sale ^^

    anyway

    do you know if it works together with opsives third person controller?
     
  8. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi Arganth, yes unfortunately DRCS is not anymore on sale !

    In general if the Physics Raycast and Spherecast are working -> DRCS should be working ok as well. It just needs initial position and direction to raycast and spherecast !
    DRCS is alternative to Physics Ray/Spherecasting... however i can not test it as i do not own the opsive's controller.
     
  9. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    DRCS is back on sale for those who are interested...
    Cheers !
     
  10. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,
    just a quick update on the next version on DRCS...
    The main big new feature is the custom LOD support...
    The Mesh Grouping Tool will be able to setup triangle tags per LOD now, or you will be able to disable tags!
    It is almost done and i hopefully will be able to update it this month !

    The LOD part might be released as beta until there is enough feedback in order to make it final... It has been thought for a long time and the current variant seems to be easy and intuitive to setup. However, will need user feedback on that in order to be sure it is useful and done well...!

    Thank You !

    DRCS_LODs.png
     
    Last edited: Sep 13, 2017
    LennartJohansen likes this.
  11. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,
    DRCS v1.73b was just uploaded to the store for review.

    The update will be considered as "Beta" for some time based on user feedback.It is tested though and it works, however it will be great if i can receive some feedback on the feature in order to finalize its state !

    For those who are interested and do not own a copy, the price will be set from 30$ to 20$ for a limited time - while the package is in "Beta" stage... this may be for a few days up to a month !

    * The major new feature is the custom LODs which will allow you to use a simpler meshes in distance... Up to four LOD levels will be supported for the current version but this limit might be increased.

    * LOD meshes can be swapped at run time which means the cheaper meshes will be rendered which is kind of rendering optimization and is always good. You do not have to use Unity's LOD system for these objects in case you do!

    Known issues for this release regarding LODs:
    * while in editor some times you get error message that culling groups should be disposed manually. I have to catch when this is happening as the culling groups are disposed in general ! Builds should be OK !
    * swap a skinned meshes glitches some times (rigid meshes are just fine)

    Some new features that might come at some point are:
    * using a BVH tree for accelerating initial intersection of objects ( This might help in case you have many objects to faster test bounds for intersection )
    * using a Scriptable Object container for LODs - the idea is all the objects which are actually the same prefab to use a single data container which means that some memory will be saved instead of making one copy per object

    Thanks !
     
    Last edited: Sep 24, 2017
  12. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys,
    the new update is now available... The price is be set from 30% to 20$ while in beta !

    Any feedback will be appreciated !

    Thank You !
     
  13. ranaUK

    ranaUK

    Joined:
    Mar 1, 2017
    Posts:
    166
    @Vagabond_ , I'm interested in this asset and am wondering if it can help me in the following scenario?

    I'm using two character models (rigged mecanim) and a bunch a colliders to detect physical contact: i.e. A punch to head: basically a source and target.

    Thanks
     
  14. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, i think in your case there must be some specialized system which is especially designed for the purpose... With DRCS you can still use the sphere cast method eventually to create some detection system, but i think you will need a specialized approach tor your needs !

    Best Regards !
     
  15. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    @Vagabond_

    Hi,

    Just letting you know that we use DRCS in our game, and we noticed that you have a rather nasty issue with reallocating ObjectMemory objects every frame when it's not necessary. This was causing a huge GC spike for us every few seconds.

    The fix is to add a Clear method to the ObjectMemory class (in DRCU.cs):

    Code (CSharp):
    1. public void Clear()
    2. {
    3.     hitInfo.Clear();
    4. }
    And in DRCMesh.cs, change line 838 from:

    Code (CSharp):
    1. oM = new ObjectMemory();
    to:

    Code (CSharp):
    1. if (oM == null)
    2.     oM = new ObjectMemory();
    3. else
    4.     oM.Clear();
    Daniel.
     
  16. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, sure, this will be fixed ! Thanks for the feedback !
     
  17. Sarudan

    Sarudan

    Joined:
    May 21, 2011
    Posts:
    65
    @Vagabond_

    Hi again, we've just noticed with our game that after a period of playing (at least an hour), DRCS stops working altogether. I'm not sure what the issue is exactly, but I wanted you to know. It's happened a few times now.
     
  18. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys,
    just to let you know about a couple new features which should come in v1.80 ( which is in development ).

    1. You will be able to use a shared mesh object asset between all the instances of a single prefab which should save some memory

    2. Another new thing is that you will be able to set up separate meshes for visualizing in game and for intersection.

    So now a new asset should be created internally in case you do not use a shared asset and LOD will be automatically setup whenever you add a second set of meshes to the asset.

    Thanks !

    DRCS_1_80.png
     
  19. bloodsyphon

    bloodsyphon

    Joined:
    Feb 10, 2016
    Posts:
    2
    Does DRCS work with an orthographic camera?
     
  20. halecc

    halecc

    Joined:
    Dec 17, 2016
    Posts:
    33
    Any chance of adding spherecast all if its not too troublesome?
     
  21. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, the DRCS.SphereCast(...) method always returns ( by default ) a list with all intersected objects!
    You may want just to give the end point to be far from the start point. Note that this method is more expensive than the raycast and it can be slow if you intersect many objects in one frame !
     
  22. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, i haven't tested this actually - have to check this and will write back when do so.
    But i guess it should be working if you generate correct rays using Camera.ScreenPointToRay method !
     
  23. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, guys just to let you know that i am doing an update and will try to upload it to the store this week as beta in order to get some feedback !

    What's new:

    * The system is now wrapped into a namespace "DynamicRaycast"
    * Mesh data is now stored into a scriptable object which is shared between clones ( this will save some memory )
    * LODs are now taking two meshes - one used for visualizing in viewport and one used for intersection

    upload_2018-7-9_8-25-34.png

    P.S. just a notification in case someone is planning to use the system in a project !

    Cheers !
     
    halecc likes this.
  24. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi guys,
    i am almost ready to update to the v2.0. At first it will be set as beta (b1) and today i am experimenting with C# Jobs.
    As i see there is a good chance to get it ready for the update. May be only the raycast methods at first will be implemented in order to get some feedback !

    You can see the test code and C# Jobs in action in the video !
    Thank You !
    P.S. I am still experimenting but the Ray/Triangle intersection test is around 5 times faster currently !
     
  25. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,769
    I was just wondering, if you are doing any update toward ECS + Job System. But what you stating you are doing indeed. That would be great, as efficient ray cast system is more than desired with current ECS.

    Looking forward.
     
  26. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    352
    Hi @Vagabond_

    This asset package sounds great & will probably save me a LOT of work :)

    Can I just confirm a couple of things:
    1) is the implementation entirely C# (i.e. no special shaders)?
    2) have you tried it with the IL2CPP scripting backend?
    3) have you ever tried it on console(s) (PS4 / Xbox One / switch)
    4) assuming the answer to 2) or 3) is "no" is the supplied source code 100% complete in case I need to change it?

    cheers!

    Alex
     
    Last edited: Nov 19, 2018
  27. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hey Alex,

    1. Al the code is pure C# - no shaders are used in the system itself, except a vertex color shader for visualizing meshes when editing mesh tags !
    2. I actually have implemented all the recommendations i found on the IL2CPP blog, and Il2CPP showed like x3-4 speed boost even on android devices. I would actually recommend IL2CPP as it is faster, at least in my tests !
    3. I haven't tried on any console cause i do not develop anything for them and do not have access to any dev kit, but i don't think there is something that would prevent from compiling for consoles...
    4. The code is 100% provided and you could alter it in any way you need !

    For more information, feel free to ask !
    Cheers!
     
    darbotron likes this.
  28. darbotron

    darbotron

    Joined:
    Aug 9, 2010
    Posts:
    352
    Perfect!

    Thanks so much for getting back to me.

    Alex
     
  29. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    153
    Hi @Vagabond_

    Does DRCS support physics materials?
     
  30. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, hmm i don't think i understand your question actually !
    Physics materials are supposed to describe friction characteristics between two rigidbodies with colliders.
    How you would like them to be integrated with raycasting (i.e. how would you use physics materials with such system) !?
    I might consider implement this !
     
  31. C_p_H

    C_p_H

    Joined:
    Nov 24, 2014
    Posts:
    153
    Thanks for your prompt response @Vagabond_

    I'd like to utilize the features DRCS currently offers but combined with the capability to assign layers of physical materials for the increased chance of projectile ricochets based on type of materials, visual impact effect based on type of materials, and impact sound effects based on type of materials.

    Greatly appreciate your consideration.
     
  32. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    You welcome !

    I think i understand what you want to have as an option, but the actual behave of a projectile after it detects a mesh would be a job for the physics system which will require a collider, and all this is done internally in the Physics system. In other words, there is no way for the DRCS to tell a projectile how and where to go after intersection, simply because the meshes do not have any type of colliders !

    If i understood your request correctly, there is no way for you to deal with this without the mesh have a collider with physics material, or you will have to calculate your own methods for applying correct physics forces to the projectile depending on material properties which requires heavy math and physics knowledge !
     
  33. HanAusBerlin

    HanAusBerlin

    Joined:
    Sep 13, 2017
    Posts:
    76
    Hi,
    I bought your asset, hoping that I could achieve the effect shown on the picture somehow (bullets that impact in the body). I might have misunderstood what this is about, but cant find anything helpful in the demoscenes. I want a character that I can shoot at, with impacts of the bullets at the right spots and a loss of lifeenergy depending on the spot where it got hit.
    Is this somehow possible - otherwise and if possible I would request a refund. :-(
     
  34. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    This is exactly what it is about. To be able to intersect meshes. Just go through the docs, everything is explained there.
    DRCS documentation...
     
  35. HanAusBerlin

    HanAusBerlin

    Joined:
    Sep 13, 2017
    Posts:
    76
    Hmm, I looked into that and - as a non coder - can't really find the part to make it possible. How about a demoscene with that functionality as shown in the picture?
     
  36. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    The picture is always with marketing purpose, but of course is all about detecting the mesh so it is correct !

    The DRCS system is a generic intersection system and i can not make all the possible demos !

    No matter what system you get you always have to write some code - for example what happen if you detect this or that part of the mesh etc etc ...

    You use the mesh grouping tool to define per triangle tag ( if you need ) and then you can take different damage values based on the tag. But you have to define this for yourself of course cause i couldn't know your needs !
    You also get the closest bone, so you can do different things using that information.
     
    Last edited: Dec 11, 2018
  37. Deleted User

    Deleted User

    Guest

    Hey,
    Im interested in this Asset, i just have some questions before i buy it...

    We working on a Shooter which needs 1st detect the Mesh ( Check )
    The Layer System is really interesting and would also help a lot with hit detection, other Particles and more for the NPC, the question is how compatible is it with UMA?
    Because our character is generated with UMA which mean we have to assign the Layers somehow to the current Character, also when the Player decide to ware a other shirt we need to redo the assignment.
     
  38. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, if i can remember correctly it should work. Sometime ago someone asked me if it is working and we came to the point that there is a way. I can't remember how to set up because i am not sure how UMA is working. I may give it a try, but as soon as you have skinned mesh component it should work.
     
  39. Deleted User

    Deleted User

    Guest

    I think i found a way.
    Getting the Mesh would be the easy part.
    The problem is the Hit Detection, because to layer the mesh for head, arms and all the other body parts would be a huge problem when the mesh changes and become a completely new shape after wearing a new shirt for example.
    So my idea is to get the closest Bone of the character from the Ray Impact and define from this constant position the damage value, the bone structure is the only constant thing in this case.
     
  40. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    You actually add a separate component to each skinned mesh. I guess any shirt is a separate mesh, still skinned to the same skeleton but as a separate mesh ! You might consider exclude cloth from intersection because they are not always tightly fit to the body may be !?

    For procedural meshes, there is no any specific setup workflow.
     
  41. Deleted User

    Deleted User

    Guest

    In UMA all become one Skinned Mesh for performance, you can separate it but i think i found a other solution which maybe is only good in my case.
    We only have like 20 to 30 Character in the same scene at once because of gameplay reasons which mean we have space for more Meshes and don't need to look so much on performance like maybe other Games, also we don't aim for high poly AAA characters we have a low poly flat shaded concept.
    We can create a second character mesh inside the current character only a little smaller to not having problems with the overlapping and only generating him without any cloths and hairs to have just the body and this shape for the hit detection.
    Translating the bones just to the same positions like the real character without any new components needed.

    However im going to buy this asset, support is there and the system looks really good
     
  42. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Well, you actually can use different meshes for visualizing and intersection. There is a LOD sub system where you can lod separate meshes for intersection. If you can duplicate the body only and load it into the slot you can then have the body only for intersection and other whole mesh for visualization !
     
  43. Deleted User

    Deleted User

    Guest

    Sounds good i will give it a try soon, i already have buy it and need to finish something other first but as soon this is done i can start working on the Hit Detection.
     
  44. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    sorry for the dumb question but does this work with grass ? or objects that don't have collider ? Thanks !
     
  45. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, it works with non-skinned meshes as well, but using it with grass or objects that are copied many many many times is not something i would be even think about doing. This system suppose to be used with the most important objects in your project.
     
  46. Deleted User

    Deleted User

    Guest

    Hey,
    Im currently working on the Hit system and im getting a error.
    error.png

    What i did is creating the Skinned Mesh Component at runtime to work with my UMA mesh
    Code (csharp):
    1.  
    2.  
    3. var renderer = this.GetComponentInChildren<SkinnedMeshRenderer>();
    4.               if ( renderer != null && !init )
    5.                 {
    6.                     init = true;
    7.                     renderer.updateWhenOffscreen = true;
    8.                     if ( RaycarstMeshObject == null )
    9.                     {
    10.                         RaycarstMeshObject = this.gameObject.AddComponent<DRCMesh>();
    11.                         RaycarstMeshObject.usesBlendShapes = true;
    12.                         RaycarstMeshObject.Initialize( renderer, this.transform );
    13.                     }
    14.                 }
    15.  
    16.  
    No errors but when i fire a Raycarst im getting on some areas of the Mesh where the ray should hit this error above
    Code to shoot out the Raycarst
    Code (csharp):
    1.  
    2. if ( DynamicRaycast.DRCS.RayCast(
    3.      new DynamicRaycast.DRCRay( arcList[ i - 1 ], ( arcList[ i ] - arcList[ i - 1 ] ).normalized ),
    4.      Vector3.Distance( arcList[ i - 1 ], arcList[ i ] ),
    5.      ref info.meshHitInfo,
    6.      false ) )
    7.        {
    8.             info.HaveMeshHit = true;
    9.             break;
    10.        }
    11.  
    12.  
    How ever the error does not come from arcList[ i - 1 ], this would match the exception but it's not the case i made a check first.

    Maybe im missing something, it was the first try on this system
     
    Last edited by a moderator: Feb 3, 2019
  47. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, please contact me by the support email provided !
    I tested the part of your code by replacing the arcList array with my logic and it works on my side.
    So send an email and we will figure it out !
    Thanks !
     
  48. Deleted User

    Deleted User

    Guest

    Hey, thank you for the offer, i have solved the problem already.
    UMA was about to change the Race after the skinned mesh was initialized in the Dynamic Raycast System which destroyed the Skinned Mesh Renderer so he initialized the wrong Mesh.
    I was trying then to Initialize the Component with the correct Mesh again but this was not the correct solution, which gives me this error.
    I solved it by Initialize the DRCMesh one time after the correct Race was given from UMA.
     
    Vagabond_ likes this.
  49. MarkHenryC

    MarkHenryC

    Joined:
    Nov 30, 2009
    Posts:
    67
    Hi. I was wondering if this would be a feasible use of your product:

    I have a hair simulator using cloth physics. It's relatively lightweight, as the moving "hair chunks" are handled by 64 meshes of 54 vertices each (this may have to double). I need to detect a hit on any of these cloth/skinnedmeshrenderer objects and get the UV of the material's texture map. I saw your comment on grass, saying it's only for the most important scene objects - which makes sense - but would this scenario be also overloading it? The big concern is that it's for mobile VR, so I don't have much performance headroom.
     
  50. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,
    well as at first. it looks ok, your scenario shouldn't overload the system in general.
    However, as you are targeting mobile platforms i couldn't say exactly how it would perform, as mobile devices have wide range of CPUs, plus i am not really into VR.

    I know DRCS is working in VR because i have been told it does !
    IL2CPP helps with the performance in my tests even on mobile - a little tip !

    I would say it is ok, but always depends on whole scenario, so it is up to you to decide if you give it a try !

    Thank You !