Useful Functions - Pottus/ColAndreas GitHub Wiki
You'll notice quite a few functions in the include that are provided just to make some things easier and to set an example. In this page I will explain what each of these example functions do and why they are included.
Example Functions (included in the include)
- CA_FindZ_For2DCoord
- A simple raycast, from an
700.0
to-1000.0
at the specified X and Y location. This returns a float value that represents the highest point at those coordinates. - This is the ColAndreas version of the entire MapAndreas plugin, all in one function and a lot more accurate. The parameters are also the same. You can literally just turn the
MA_
toCA_
to upgrade from MA to CA.
- A simple raycast, from an
- CA_RayCastExplode
- It casts rays in ALL directions. It's basically
CA_GetRoomCenter
but instead of returning the center of 3 points it returns every collided point as an array. - This could be used for example, calculating the size of a room instead of just the center as
CA_GetRoomCenter
does.
- It casts rays in ALL directions. It's basically
- CA_IsPlayerOnSurface
- Boolean yielding function that tests whether a player has any collision beneath them or not.
- CA_IsVehicleOnSurface
- Boolean yielding function that tests whether a vehicle has any collision beneath it or not.
- CA_IsPlayerInWater
- Boolean yielding function that checks for the water planes at a players location.
- CA_IsVehicleInWater
- Boolean yielding function that checks for the water planes at a vehicles location.
- CA_IsPlayerNearWater
- Boolean yielding function that checks for the water planes around a players location.
- CA_IsVehicleNearWater
- Boolean yielding function that checks for the water planes around a vehicles location.
- CA_IsPlayerFacingWater
- Boolean yielding function that checks for the water planes directly in front of a player.
- CA_IsVehicleFacingWater
- Boolean yielding function that checks for the water planes directly in front of a vehicle.
- CA_GetRoomHeight
- Casts two rays, one up and the other down from the specified location. If both of these are successful then the function will return the distance between the two collided points.
- CA_GetRoomCenter
- Casts 3 rays, in 120 degree angles from the specified point. If these are all successful then the circle they form is calculated. This function returns the center X and Y as parameters and the radius of the circle as the return value.
- CA_IsPlayerBlocked
- Boolean yielding function that tests whether a player has any collision in front of them or not.
- CA_IsVehicleBlocked
- Boolean yielding function that tests whether a vehicle has any collision in front of it or not.
Other Useful Functions
Math
- CA_EulerToQuat
- Converts a Euler angle to Quaternion
- CA_QuatToEuler
- Converts a Quaternion angle to Euler