A downloadable tool

Physcast Visualizer 

A physics Shape Caster & Visualizer Tool

Physcast visualizer is a collection of physics caster components where each one corresponds with each physics cast API method of Unity, it exposes the cast parameters in the editor to easily tweak it's behavior (how to cast is done) and also visualize for visual debugging.




Provided Casts & Visualization components:


Shape Casts

Cast Box (Box Cast)
Cast Sphere (Sphere Cast)
Cast Ray (Ray Cast)
Cast Line (Line Cast)


Shape Checks

Box Check (Check Box)
Sphere Check (Check Sphere)
Capsule Check (Check Capsule)


Shape Overlaps

Box Overlap (Overlap Box)
Sphere Overlap (Overlap Sphere)
Capsule Overlap (Overlap Capsule)

As illustrated above, the casters is categorized into 3 types of group; cast, checks & overlaps mirroring the grouped types of physics cast in Unity. (Having also each cast's name similar with it's counterpart physics cast method already gives you an idea on how it behaves).



Properties Groups


Each caster has it's properties divided in multiple groups, mostly a group of 3 (some are only 2)

  • The 1st group which is the base group of properties being present in all casters is the  ( Visualizer Properties ) which gives you control over tweaking common cast parameters that are found among all casters.
  • The 2nd group is the ( Shape <Type> Properties ) which is more specified towards what type of cast is the caster is, casters within the same type share this common set of properties.
  • The 3rd which is the last group ( <Caster> Properties> ) is the ones that pertains directly to the properties that specific to the cast.  Properties that are tied to what kind of shape the cast does.

(All the exposed properties in the caster that are tweakable can also be set in code)



1st Group ( Base Properties )



- Controlled Properties -

Visualize - Toggles the visualization of the caster

Auto Cast - Toggles automatic casting of the caster (run per frame)

Direction - The local direction where the cast is pointed towards to.

[  This is also present in other casters that naturally doesn't need a direction in order to cast, but you can choice to do so or just choose "None" if not.  This property is not present in all casters like Cast Line & capsule based shape casters ]

[ Note: The on detection exit event will only trigger when the caster no longer detects a collider BUT WILL NOT TRIGGER when the detected collider changed, in which scenario a collider nearer to the cast has collided with the cast ]


- Debug Properties -

Casting - Is the cast is running in the current frame?

hasHit - Does the cast detected a collider?



2nd Group ( Cast Type Specific Properties )


Shape Cast


- Controlled Properties -

Max Distance - Length of the cast.

Target Tags - Specifies what objects with the matching tag is a valid cast hit.

Direction Origin Offset - Offset of the origin point of the cast relative to the direction it is casting.

[ Note: The "Cast Line" caster doesn't need distance or offsets parameters when casting so those properties is not present on it ]


- Debug Properties -

..........you already know what these are.


Shape Check

There is not much here, i mean is literally just one property it's readonly. This field is basically just the mesh that the shape check caster uses to visualize it's cast.

If the mesh for this field is missing just simply go to the script file itself and assign the mesh as the default reference. 

BoxCheck Cast Mesh -> Unity's default cube mesh

SphereCheck Cast Mesh -> Unity's default sphere mesh

CapsuleCheck Cast Mesh -> 8Ringed_Cylinder from the cylinder model found at the root folder/directory of the asset.


Shape Overlap

- Controlled Properties -

Cast Mesh - This field is basically just the mesh that the shape check caster uses to visualize it's cast.

Offset - Origin offset of the cast.

Target Tags - Specifies what objects with the matching tag is a valid cast hit.


- Debug Properties -

Hit Count - The number of colliders this overlap cast detects.

Hit Console - Display the name of the objects the cast detects alongside with layer & tag.



3rd Group ( Cast Shape Specific Properties )

The properties found in here are related to shape of the cast itself, so if it's a Cast Box then expect a vector3 extent property on or if it's an Sphere Overlap then float radius property. 

There isn't much need of thorough explanation but in the aspect of end point based casts (like the Cast Line & capsule based shape casts) it's a different thing. 


End Point Based Casts


End point based casts are the kind of casts that needs 2 vector3 positions that acts as the start and end points of the cast. Anything that collides in between is detected. 

In the case of the Cast Line, as you've already know. casts a thin line from the start vector to the end vector, While in capsule based shape casts there is another property pertaining to the overall thickness of the capsule shape cast which is it's radius that let's it detect a wider area than a thin line.


- Controlled Properties -

End Points Source - Pertains to where vectors is the start and end point based on.

Transform: Uses the global position of Start & End Point Transforms as the Start & End Points of the cast. [Note: Start & End Point Transforms fields must be assigned ]

Vector: Uses the manually set vector in code as the start and end points of the cast. To properly use this set the Start & End Point vectors and switch to Vector Points Source before casting.

Start & End Point Transform - Transform used for the  start and end points of the cast.


- Debug Properties -

Start & End Point Vectors - These fields are readonly as they can only be set or changed through code instead of assigning a transform in the editor to based off the position of the Start & End Points of the cast. These properties are primarily used when manually casting through code as it only needs a Vector3 position.

Start & End Points - These are the Vector3 positions where the Start & End Points of the cast is. These values changed based on what type of End Point Source is set. If it's Transform then it's values are based of the  position of the Start & End Point Transforms, if it's Vector then it's based off the Start & End Point Vectors.


Link to repo: https://github.com/INFGameDev/Phsyics-Cast-Visualizers