Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dynamic RayCast System - C# Jobs upgrade is available !

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

  1. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    DRCS_Banner.png
    This is colliders free system which uses custom Ray and SphereCast functions to detect objects. It supports Skinned and Rigid(Non Skinned) meshes ( with custom LOD support ).
    Asset Store Link - Current Version 2.0

    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    Features
    • RayCast and RayCastAll against triangular meshes
    • SphereCast against triangular meshes - useful for simulating (projectiles)
    • OverlapSphere - test against bounds and triangular meshes
    • OverlapBox - test against bounds and triangular meshes
    • Object types: Skinned, Rigid (Non Skinned)
    • Custom LOD Meshes - load some LOD meshes for calculations and rendering
    • Swapping LOD meshes at runtime
    • Temporarily exclude objects from the system
    • Adding components at runtime
    • Get the closest bone to a hit point - This way you can attach some objects to that bone transform.
    • Stick objects to the hit point on Skinned Meshes - Every frame a new position is calculated.
    • Rich “DRCHitInfo” class filled with information about any intersected object
      • GameObject hitObject;
      • Renderer hitObjectRenderer;
      • Vector3 hitPoint;
      • Vector3 hitNormal;
      • float hitDistance;
      • Vector3 barycentricCoordinate;
      • Vector2 textureCoordinates;
      • int triangleIndex;
      • string drcTag;
      • ObjectType hitObjectType;
      • DRCM drcmObject;
    • Mesh Grouping Tool - select and group triangles by tags, e.g. define character's head with tag "head"



    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    v 2.0
    ------------------------------------------------------------------------------------------------------------------------------------------------------------

    * The system is now wrapped into a namespace "DynamicRaycast"
    * Changing the LOD system to take two separate meshes - for visualizing and for intersection
    * Moving the mesh data to Scriptable Object assets. This way mesh data can be shared between objects of the same type

    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    v 1.73
    ------------------------------------------------------------------------------------------------------------------------------------------------------------

    Major new feature:

    * added custom LOD support ( using meshes with lower detail in a distance )
    * swapping LOD meshes at run time ( good for rendering optimization )

    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    v 1.60
    ------------------------------------------------------------------------------------------------------------------------------------------------------------

    New Features and improvements
    • Now the Multi-Threading is moved to the DRCS script as a global option and all the objects are distributed to different cores. No more MT per object is used!
    NOTE: MultiThreading currently uses the integrated ThreadPool in .NET 2
    NOTE: Consumes more memory because of the synchronization but not that much
    NOTE: MultiThreading will probably change in future when Dot Net version is updated.
    NOTE: Currently only Windows, Mac, Android and iOS are supported because are the only tested platforms.​
    • Added OverlapBox method - simulates an oriented box in spaces which collects all the DRCM obejcst within its volume. It can be used to test objects by bounds only or by testing mesh triangles.
    • OverlapSphere method now can test objects against their meshes as well (previously was working only with bounds)
    • Further code cleanup and small optimizations
    Changes
    • MONO.Simd plugins is now completely removed (it was used before with the MehsGroupingTool)
    • The KD-Tree is removed from SRCMesh objects and it's only used with MeshGroupingTool
    • DRCShape script is removed
    Limitations
    • If you want to stick an object to a mesh which uses blendshapes, the sticking point will not take into account the blend shapes.
    ------------------------------------------------------------------------------------------------------------------------------------------------------------
    For more information read the documentation.
     
    Last edited: May 5, 2019
    Gozdek and Ghosthowl like this.
  2. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    how is hte performance compared to traditional raycast against colliders?
     
  3. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    i suggest trying the web demo... : )
    and i really tried to explain everything in details as much as possible in the documentation...but i will try to explain my view point here too... Sorry for these quite a few lines i will write but just to give max details... :)

    In Unity testing against standard mesh collider is mush slower than testing against the primitive colliders which are represented with mathematical formulas but is still fast, that's because the physics engine is deeply integrated into the engine... The Sphere Collider is of course the fastest to calculate. In opposite the mesh collider is the slowest. Unity Engine misses such an option to cast a ray against skinned meshes without colliders, that's why i decided to write such a script. Unreal Engine for example has that feature integrated which they say is expensive.
    So the plugin is of course slower compared to traditional raycast against Unity's colliders but has some other advantages! In general is "exotic" plugin not suitable for massive scenes. The good thing is that you can have your enemies without colliders in the scene which will give you greater performance but in other case if your skinned meshes are too heavy you will get some spikes when testing many of them at once. So the plugin may be used for real projects but depends on the complexity. In the project i work on( a classic FPS shooter) we have some generic rigs with 20-30 primitive colliders each, and we can not have more than 10 at once because the performance drops with about 20-30 %. Without colliders i will be able to have more than 30 of them which is great.
    Also a new version comes with some new features added to the hit info structure such as:
    - Texture coordinates
    - Baryscentric coordinates
    - Triangle index
    and also
    - Adding components at Run Time
    - Better support for static meshes(you can move them now when set to "Movable" mode)

    If you have some more questions i will be glad to give some numbers on performance :) !!!
     
  4. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    So what your saying is if your rig has a certain amount of joints then this would be better. What is a good collider number for a character? At one point would you switch to yours on a desktop pc title?
     
  5. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Because of the need to transform the vertices every time you request(when you shoot with a gun f.e.) it is important to keep the bones count as low as possible. Every vertex can be weighted to up to 4 bones that's why as many bones and vertices you have the lower the performance will be. In the web demo, one of the rigs has about 55 bones(joints) and about 3700 triangles and the performance with it is great but with the other rig which has more than 120 bones and more than 13000 triangles (in my opinion this is a heavy rig for Unity) first the FPS is low because of the rig itself and i can see lags on my old Intel dual core 2GHz CPU when shooting on many characters at once... both examples with 50 enemies in the scene - of course the scene in not a complex one. So if you keep a rig with up to 30 - 50 bones and 5000 triangles you can get great performance but depends also on the CPU on which the plugin relies...
     
  6. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    v1.1 available with Texture Coordinates and some more useful features added!
     
  7. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Last edited: Nov 13, 2014
  8. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    379
    This sounds great..but will it work ok using the oculus rift with the unity integration package?
    Thanks
     
  9. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Unfortunately i do not have access to Unity Pro and the Oculus Rift SDK to test. But if you have, in the post above yours is a link to a fully functional demo with watermark. You can download it and test it.
     
  10. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    So in summary, all we need is a classic collider for detect collision with the environment ( terrain and other) and your tool?.

    Bookmarked. :cool:
     
  11. cl9-2

    cl9-2

    Joined:
    May 31, 2013
    Posts:
    417
    Are there any plans for a source code version?
     
  12. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Yes.
    The plugin was designed to remove the need of adding many box and capsule colliders to the skeletal structures of any skinned mesh - f.e. all of your enemies - NPCs, because this method is not precise and also like you know moving colliders are slow. So the idea behind all that is to use normal Unity colliders for the environment and to use the system to detect the enemies using ray casting without adding one collider to them. Let's say for a game like Counter Strike you add normal colliders to all the static meshes and use the system with the players. This is not a physics plugin which can detect collisions between colliders but only detecting meshes using ray casting. There are of course many scenarios where you can use the plugin and not only for simulating weapon firing. It also works with static meshes where you can add the SRCMesh script let's say to a wall and you will be able to detect it when you are shooting but you will be able to pass trough it if not add Unity collider. For best results you have to combine Unity's Physics system and DRSC system.

    First of all i am thinking of adding some more features.
    1. Adding simple shapes like spheres and boxes like the Unity colliders.
    2. Method for separating logical parts of some mesh - "Grouping Polygons By Tags" - f.e. if you have a single soldier mesh with a helmet you will be able to add some tag to his helmet and when detect it will not applying damage.
    3. Adding some kind of projectiles or at least sphere casting.
    4. Try to find some more ways to optimize the performance. Unity is not thread safe, that way i cannot add Multi Threading support.

    So. while i'm doing that i will decide if i will provide a source code version with the next update.
     
  13. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks..
     
  14. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Any plans to add checking intersections between meshes instead of from a ray? Unity .bounds are axis aligned but I'm assuming what you are doing rotates.
     
  15. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Not at all. Just some kind of sphere casting to be able to simulate projectiles, and that's only if i managed to get good performance.
     
  16. Jiraiyah

    Jiraiyah

    Joined:
    Mar 4, 2013
    Posts:
    175
    I have a question, Did you write your own raycast system or are you using the internal raycast from the physics engine?
    The thing I am after, is the ability to cast rays from threading and not only in run time but also in editor, and I really can't use coroutines, simply because the stuff is AI related and if you want for example 100 AI agents check line of fire with ray casting, coroutines would be slow compared to threading.
    So the question is, will your system work on threads or not?
    thanks
     
  17. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,
    sorry i didn't noticed your question.
    Generally the system can not be used from another thread because it uses some Unity functions and as you now they can not be called from another threads.
     
  18. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    DRCS v 1.20 is Coming Soon with support for projectiles, LOD meshes, shapes and others.....
     
  19. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    ...and source code. :cool:
     
  20. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    will be included !
     
  21. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Yes i know. I 'finalized' your description. :p
     
  22. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Version 1.20 NOW AVAILABLE!
     
  23. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
  24. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    Hi, I bought your package minutes ago. It's pretty much exactly what I was looking for. Don't get too technical please, but is your code using data that has already been baked by the skinned mesh renderer or is it done again for each raycast? Just wondering about optimization and performance.

    And I'm having a problem already: I just quickly loaded the UMA crowd scene, added your player prefab and attached your main script to an empty object, set the layers to "everything" and it's working. Except raycasts seem to ignore the UMAs arms for some reason. They are going right through. Any explanation for that?
     
  25. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    The transforming(backing) of the meshes is done every time you press the "Fire" button but only if the ray intersects their bounds first. This is for optimization. There are two type of baking - using SkinnedMeshRenderer.BakeMesh() and a custom one. Just choose it from the script.

    Please give me a link to that UMA crowd scene, as i am not familiar with it.
    If these UMA's arms have collliders attached, you have to add them to a specific layer and then exclude that layer from the DRCS manager. Or probably they might be skinned separately. Then you have to add DRCMesh script to them to.
     
  26. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    https://www.assetstore.unity3d.com/en/#!/content/35611

    There are a couple of demo scenes, one of them is the "crowd".

    I'm pretty sure it's just a single mesh. That's basically the whole point of UMA: to combine different submeshes and textures into a single mesh and texture.
     
  27. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I will take a deeper look, but while the models are generated procedurally (somehow), you will have to add the DRCMesh component from script using one of the constructors. I am looking at the system. It seems to be pretty complicated.

    Update:

    I just found a way to add the component. Because the system uses something called slots to add components and such you have to add the code below in a new slot ( if you know how to make one)...

    But much more easier way ( like i did ) will be to find the "CapsuleColliderSlotScript", at the end of which in the OnDnaApplied(...) function add the following code:

    Code (CSharp):
    1. umaData.gameObject.AddComponent<DRCMesh> ().Initialize (
    2.   umaData.transform.GetChild(0).GetComponentInChildren<SkinnedMeshRenderer> (),
    3.   umaData.transform,
    4.   SkinnedMeshBakeMode.Unity);
    5. umaData.gameObject.layer = 8; "create your layer and replace it"
    Don't forget to go to DRCS manager and exclude that layer from the mask.

    One more thing. Find the "BulletProjectile" add it to a specific layer if is not already, goto Physics matrix and set the newly created layer for characters fo ignore the projectiles.
     
    Last edited: Aug 17, 2015
  28. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    Nice, thank you for the great and quick support! I will try that later.

    Two more things:

    About performance: if I raycast against a certain mesh several times per frame (think shotgun), does the mesh get baked every time or just once?

    And since you've probably learned a lot about skinned meshes, can you help me with something? I want to attach a transform to a skinned mesh (where the raycast hit), but not to an individual bone. I rather want to know the vertex weights (and corresponding bones) of the triangle that was hit, interpolate to the hit-point, and then use a script to update that transform continually as if it were a vertex of the actual mesh. That way I could attach all kinds of things and they would more or less exactly stay in place. Would be cool for a bleeding wound particle effect for example. Can you give me some advice on this? Is there maybe even something I can build on in your scripts?
     
  29. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Right now, for every ray, the mesh should be transformed. But i am already thinking about making another RayCast and RayCastAll methods which take an array of rays instead of a single ray as parameter to be able to simulate shotgun fire. But there will always be some limitation while C# is not fast language. I will try to find some more room for optimization to.

    In the process of building the plugin, i found a lot of stuff about "skinning" or "attaching" an object to a skinned mesh. But while Unity is still a little slow or how to say, such things might be considered exotic i did not focused on them. I will find something about that and will post it here.
     
  30. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    Maybe, since the user doesn't necessarily know which rays are gonna hit the same mesh, it would be good to store references to meshes you baked in a given frame. I don't know if you can add null references to each mesh easily and set them to the baked data on creation or just use a global container to look up which meshes have been baked already. I'm not very familiar with C# container classes yet, but it seems a dictionary with mesh/gameobject-IDs as key would do. And then, at the beginning/end of each frame, you can clear the data. Container search is a bit ugly I know, but certainly faster than processing the mesh again and again. The container shouldn't get very big anyway, so it doesn't really matter. Btw, you are not generating any PhysX-meshes/colliders for the raycasts, are you?

    About that attachment problem: I think it comes down to
    - finding the triangle vertices
    - transforming the same way that vertices are being transformed with bone-weight information

    But maybe I could use an actual skinned mesh for that, created on the fly, only containing weighted vertices and a function to return their current transform based on the pose of the skeleton. I will just have to look up how and where the weighting data is actually read from. I would still need to find the vertices to interpolate the weights from. Thanks for helping!

    edit: ok don't worry about my problem anymore. Thanks to your hitInfo.triangleID I think I have everything I need to do this now.
     
    Last edited: Aug 18, 2015
  31. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Thanks for suggestions. I'm almost done writing the method which uses multiple rays at once. I will just need to figure out if the performance hit is to big for real use.

    Not at all !

    Ok, that's good.
     
  32. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    I've got a little problem with your tool: after raycasting, the renderer-reference inside the hitInfo is always NULL. It doesn't seem to make a difference, whether I attach the SRC Mesh (static in this case) script to the object or not.

    edit: the triangleID is also 0 most of the time. Very rarely it's something that seems right :/
    Only the gameObject is always correct.
     
    Last edited: Aug 19, 2015
  33. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    are you having these problems with the UMA package or with another models imported from a 3D package ?
     
  34. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    I am currently testing with primitive cubes and spheres, but I am beginning to think I don't quite understand your use of collider shapes :/

    The rays without the info I wanted were most likely hitting the colliders, not the mesh.

    I thought you need colliders to detect potential hits in the "first phase" and only then the connected mesh is even being generated and tested. I also thought PhysX shapes are generally being ignored by your system otherwise.
    But now I removed the colliders from the primitives and I think it's working as I wanted. Maybe I should do some more reading before I steal your time ^^
     
    Last edited: Aug 19, 2015
  35. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Please read the Documentation. I should have mentioned there that the shape does not use the render component.
    It is useful if you want to rig a character ( put the shape scripts on the bones which don't have render components)

    I am not so good at speaking english, otherwise i could do some videos. But i will probably do it soon.
     
  36. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    v1.21 is on the store now. It contains demo scene. You can download it and check it out.
     
  37. MaxPower42

    MaxPower42

    Joined:
    Aug 1, 2015
    Posts:
    20
    Stupid question: you are using bounding boxes for the meshes internally for the raycasting right?...
     
  38. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Yes. First test for intersection with the bounding box and if there is intersection, test the mesh also.

    That's the first and biggest optimization.
     
  39. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Bought your asset, works great.

    I have some questions.

    1. I have some characters with multiple skinned mesh renderers. Now I add multiple DRCMesh compontents to them runtime, with the same root. Is this optimal for the character?

    2. Can you make an overloaded version of RayCastMouseClick(); that takes the mouse position as a Vector2. I have some use for it with a custom cursor.
     
  40. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi,

    You have to add a DRCSMesh component to all of them in order to be able to detect them. The root transform is actually a slot in which you have to load a transform which you want to access easy. Lets say you have an enemy with a few DRCMesh components in the hierarchy, and you have your main "AI" or "Health" script on the root of the character. Just drag the root of the model to the rootTransform fields of all the DRCMesh components in order to be able to call "ApplyDamage" funciton or change its behaviour on hit for example.

    I will add it in the next release, but you can just do it yourself it you can't wait.

    Find the DRCU script inside of which locate the RayCastMouseClick() function.

    Add the following coode below it

    Code (CSharp):
    1. /// <summary>
    2. /// RayCastMouseClick with custom mouse position.
    3. /// </summary>
    4. /// <returns></returns>
    5. public static DRCRay RayCastMouseClick(Vector2 mousePos)
    6. {
    7.     Vector3 mousePos3d = Camera.main.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, Camera.main.nearClipPlane));
    8.     return new DRCRay(TypeCast.V3ToV4(mousePos3d), TypeCast.V3ToV4((mousePos3d - Camera.main.transform.position).normalized));
    9. }
     
  41. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. It worked for me. good speed, but I have another problem.

    When you do a DRCS.Raycast and hit a SkinnedMeshRenderer it does not free up some allocated memory.
    Megabytes per second if you keep raycasting.

    It seems to be working good on normal meshes.

    I will try to find the problem, but you know your code better.

    you can find the bug in your demo scene, just keep shooting at one of the animated meshes.
     
  42. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Hi. Again.

    Think I found the bug. In your TransformVertices function of the skinned mesh code you bake a mesh without destroying it. was in both LOD and normal.
    Just add in a Destroy(newMesh); after you read out the vertices
     
  43. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Fixed!
    Thanks for noticing and resolve the issue.
    This is what i don't like about Unity's baking method but is unfortunately faster.
     
  44. pierresusset

    pierresusset

    Joined:
    Feb 7, 2009
    Posts:
    60
    hello Vagabon,
    I've just try the last version of your DRCS and I can't use it with blend shapes.
    Did you plan to support this kind of dynamic mesh?
     
  45. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Would that not work directly?
    The system bakes the skinned mesh, then does testing. Does not the blendshape modified vertexes include in the skinnedmeshRenderers bake process?
     
  46. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I just did a quick test and it actually works for me. Set the "Mesh Bake Type" to "Unity".
    I will make some more tests today and see if everything works well or not.

    Can you give some more details on what model you are using and how you set it up. Or if it is possible send me a project or at least the model you are using so i can check it.
     
  47. pierresusset

    pierresusset

    Joined:
    Feb 7, 2009
    Posts:
    60
    Hi, in fact, my model has blend shapes and no bones, so when the drcs mesh is applyied, it switch automatically in "Unity MeshBake Mode". Unfortunatly, this doesn't work for me (maybe it's my model).
    But I've found a work around: instead of drcs mesh, I use Srcs Mesh with a little modification:
    - In the initialize function, I've modify the code in order to accept skinned mesh renderer with no bones
    - In the raycast function, if the renderer is a skinned mesh renderer, I create a temp mesh with unity mesh bake function and I did the raycast test on this mesh, then I reapply the good mesh (this is almost what you do in the DRCS Mesh).
     
  48. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    Hi, i just tried with a skinned model from the Asset Store which uses BlendShapes and it seems it is not working 100 %.

    I was just about to upload v1.31 to asset store and i will probably do it, and will left the BlendShape support for the next release, while i have to do some research on how exactly they work. I guess unity bakes a skinned mesh with no respect to the BlendShapes.

    I see you have found a workaround for a mesh without skin information but only BlendShape. The first time i tried this morning was with object with only BlendShapes and was working with SkinnedMeshRenderer. But as i said i will do need to check that more in depth.

    If you need some help, let me know.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------
    EDIT: after a bit more testing it seems that Skinned Objects with blend shapes are working! However official support will be available in the next release.
    -----------------------------------------------------------------------------------------------------------------------------------------------------------
     
    Last edited: Sep 29, 2015
  49. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Do you think it would help running the raycast in LateUpdate. To make sure the blendshapes are processed this frame?
     
  50. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    1,148
    I made a few tests with the model from the Asset Store you pointed me to. I made it look like an ungly troll using BlendShapes, and the RayCast was correct. So i don't think doing raycasts in LateUpdate is necessary while most of the users will probably want to do whatever they will do to the objects in the Update rather then the LatUpdate function.

    I will come up with something after dig a bit more into BlendShapes and i am sure that everything is working properly. Will see when v1.32 or v1.40 or whatever version comes after 1.31.