Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Showcase Head Casting Ray to prevent Mesh Walk-through

Discussion in 'Cinemachine' started by darashayda, Dec 9, 2023.

  1. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Gregoryl

    Added the Head Ray Casting to see if we could prevent the Mesh Walk-through:



    It worked the first try!

    I will post this nasty problem with Unity's Mesh Colliders for my students after some snooze.

    Rattling side-effect, I will report this pm and think of a remedy. The rattling occurs between the Drop down ray casting and Head Casting and the Slerp function does not produce smooth enough effect.

    Character Design by shionprime01:
    hub.vroid.com/en/characters/5913166585907454725/models/9185375907283790836


    PS. BTW I develop a silly sense of humour thanks to lack of sleep! Sorry
     
    Last edited: Dec 9, 2023
  2. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Gregoryl

    FYI, my hunch was correct, we need those p1 p2 kinda Child gameobjects/points to the Player placed at strategic places. Since the different characters have different sizes and one has to place the position of the Head Casting ray at around forehead eyes or else the head could and does pass through the Meshes and the Free Form LookAt Camera goes apes!

    I like to work on Group Camera for multi-characters + Deoccluder ... but we talk and plan first to synch

    D
     
  3. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Gregoryl

    1. I already dug up my old notes on ray intersection algorithms, perhaps Möller–Trumbore (?)
    to have an alternative to Unity's and compare the accuracy and performance. Mind you I have the access to the SOURCE CODE as well so I could give you a full comparative report.

    This will allow us to investigate the annoying anomalies in more than one way and have analytical understanding as well as algorithmic understanding of the different circumstances.

    2. If you could help me a bit with Burst and DOTS then I will make a couple of efficient versions of these algorithms and experiment as well. I suspect Ray casting for different applications need different versions! For example if the algorithm does not need Normal then the Ray casting could be much faster.

    3. Sprays: These will be Ray Multi-Casting that will aid in inaccuracies and also difficult cases of falling of deep cliffs and etc. My issue is not doing it but the spread of the rays in a some manifold around the player.
     
    Last edited: Dec 9, 2023
  4. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Gregoryl

    GPU: I forgot, I believe all these algorithms we are talking about computing on the local cpu, if you have interest I could push them more and more into GPUs.

    Just a thought
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,768
    This isn't really my area of expertise but I can't help thinking that this must be a solved problem. Are you re-inventing the wheel here? I would experiment with enabling the RigidBody on the capsule and leveraging Unity's physics.
     
    darashayda likes this.
  6. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    I am thinking of using Havoc not sure as of yet. I will discuss with our account executive.

    FYI, I had used the Rigid Body + Capsule Collider and my progress was limited. I am not sure exactly why, best I speak with the Unity physics people.

    Ideas about GPU are not new and I have no novel ideas. Idea in principle is to take advantage of the GPUs availability which currently the Update functions are not and not even sure if the Colliders do?
     
  7. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    Ok I reviewed my notes and remembered the problem RigidBody + Capsule Collider: They pass through the Meshes just the same and not always they work correctly for two-sided exposed Meshes.

    Why I brought up the concept of Ray-Casting + looking at the Collider code in SOURCE CODE.

    There is absolutely no hint nor support from Unity on this anomaly, we need to do something unconventional in order to make products which deal with double-sided Meshes.

    D
     
  8. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Gregoryl if we have a Skinned Mesh which is too vibrant, so to say e.g. snaking around and placed that Skinned Mesh on a character as a permanent part of it, Capsule collider from Unity does not work properly and should not for that matter. We have adapted to some Skinned Mesh Colliders (as opposed to Mesh Collider) and only learned other past examples from others do use GPU which is a good thing to reduce the Unity's reliance on cpu-only architecture.

    I might be a bit bold saying that strategy might come-in handy with your CM cameras.

    I am tearing apart the CM character controller code and making experimental modifications, when you return need to speak with you how to organize this effort so to be useful for the community.
     
  9. darashayda

    darashayda

    Joined:
    Jun 27, 2020
    Posts:
    442
    @Gregoryl

    This is an example of a multi-character, the Autonomous Wafting Ghouls compute Boids! (CM2)



    Boids:
    https://people.ece.cornell.edu/land/courses/ece4760/labs/s2021/Boids/Boids.html

    Our quest is more complex than just not going through the walls, we like to assign multi-CM cameras to each member of the Boids and these CM cameras shall blend due to some event e.g. some of the Ghouls turn into projectile weapons and dart at the enemies approaching the Player.

    For many such algorithms, we need to be proximity measures based i.e. distance sensitive and Capsule Colliders are not sufficient.


    As you can see the Boids goes through the Meshes and same problem with double-sided Meshes persist: