You are on page 1of 8

The Object Face Detection system is a universal system that scans for the closest object to the desired

object that the script is attached to. The system is tailored to your games needs with full control and customization over where and how you want to scan an objects faces. It a solution to give your game the creativity it needs. If your game needs unique cover systems like Gears of War or parkour systems like Assassins Creed ,or even basic FPS functions like ladder climbing and object hopping then this is the script for you. The system continuously scans the closest object for near edges and corners of the intersected object, and returns detailed information about the relationship between the object that is scanning and the object being intersected. All angles and distances to the desired object are calculated as the system scans the objects face. You will have control over how accurate the system is, where you want to scan for objects, and what faces get scanned or not. The script may be used both ridged and non-ridged bodies. Please open up the example scene to get a feel for what is happening and how the system can be controlled to you desire. The included, Character Control , script is a quick look at a basic use that the system can provide for a game. During the example scene game play, use WASD to move and V to snap to a face.

How to set up
(*transform refers to the object the detection script is attached to)

1. Place script on object of choice that you want to do the scanning. 2. Create a layer that you want the object to detect and set the objects layer to a different one so no interference occurs. Or just the transforms layer to one other than default. 3. Turn on the show gizmos option in the upper right hand corner of the play screen. 4. Make sure that your global up coordinate is in the positive Y direction. 5. For common face detection set these variables to these values in the inspector:

6. Move you object close to other object to see results. (You should see something like in the picture below. This mean that you object is close enough to interact and collect data with other objects). 7. make sure the game is on PLAY and not PAUSED or STOPED to visually see any adjustments made to the variables.

Variables and Data


Data:

Shortest Point global point of the center green ray Highest Point global point of the blue ray Lowest Point global point of the cyan ray Right Most Point global point of the yellow ray Left Most Point global point of the purple ray Shortest Vector local direction of the center green ray Highest Vector local direction of the blue ray Lowest Vector local direction of the cyan ray Right Most Vector local direction of the yellow ray Left Most Vector local direction of the purple ray

Ray Length adjust to desired collision detection radius Shortest Ray Distance The closest distance between colliding object and transform (length of the green ray). Distance From Closest Point The closest point on the colliding object to transform Distance From Closest Point To Highest Point distance between closest point and highest point Highest Ray Distance length of the blue ray Angle To Top angle between closest point and highest point in reference to transform Distance From Closest Point To Right Most Point distance between closest point and right most point Right Most Ray Distance length of the yellow ray Angle To Right angle between closest point and highest point in reference to transform Distance From Closest Point To Left Most Point distance between closest point and highest point Left Most Ray Distance length of the purple ray Angle To Left angle between closest point and left most point in reference to transform Distance From Closest Point To lowest Point distance between closest point and lowestmost point

Lowest Ray Distance length of the cyan ray Angle To Bottem angle between closest point and lowest point in reference to transform Corner At Left true if system detects an open corner Corner At Right true if system detects an open corner Corner At Top true if system detects an open corner Corner At Bottem true if system detects an open corner

Variables:
Corner Distance Check set this distance to a value of how accurate you want the corner check. This value will adjust the green rays that point to the top, left, right, and bottem when a corner is detected. Setting this value to high or low may attract unwanted results. Detectable Environment - select a layer that you want to system to detect(set the transforms to a different layer!) Check Face Min / Check Face Max - set these values to the range of face normal you would like the system to can for. For example, setting the Min Y to -1 and the Max Y to .5 will cut out any floor detection and setting the Min X & Min Z to -1, Max X & Max Z to 1, will allow to system to scan the walls of the intersected object. Current Hit Normal this shows the face normal values of the current face being scanned. This is helpful for understanding what CheckFaceMin/CheckFaceMax values will be best fit for you.

Show All Rays check this to see where you are scanning(*have game running to see rays) Show All Rays Colliding check this to see all rays grabing info about the faces Scan Top check this to scan for an upper corner/point Scan Bottem check this to scan for a lower corner/point Scan Left check this to scan for a left corner/point Scan Right check this to scan for a right corner/point Umax adjust this value from between 0 and 3.14 to scan along the Y axis Umin adjust this value from between 0 and 3.14 to scan along the Y axis Vmax adjust this value to scan along the XZ axis Vmin adjust this value to scan along the XZ axis XZ_Acurracy lower this value to have more points scanning the field along the XZ axis Y_Acuracy lower this value to have more points scanning the field along the Y axis

Octent This is the region that the system sees the closest face in relation to the transform

Current Colliding Game Object this is the current object being detected

full accuracy , with Show All Rays checked on, and a full U & V range

You might also like