Advertisement
NewbProgramming

ColAndreas for SampSharp

Mar 22nd, 2017
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 49.67 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. using SampSharp.GameMode;
  5. using SampSharp.GameMode.API.NativeObjects;
  6. using SampSharp.GameMode.World;
  7.  
  8. namespace SAMP.Include
  9. {
  10.     class ColAndreas
  11.     {
  12.         #region Variables
  13.  
  14.         // Apr 27, 2016 Last commit.
  15.         static public readonly int VERSION      = (10400); //a.b.c 10000*a+100*b+c
  16.        
  17.         static public readonly int MAX_OBJECTS  = (50000); // This is the internal limit.
  18.        
  19.         static public readonly int WATER_MODEL  = (20000);
  20.  
  21.         enum ObjectType
  22.         {
  23.             Normal, // This used to be called "Object"
  24.             Dynamic
  25.         }
  26.        
  27.         class ObjectStruct
  28.         {
  29.             public GlobalObject Object = null;
  30.             public int CollisionId = -1;
  31.             public ObjectType Type;
  32.         }
  33.  
  34.         static List<ObjectStruct> ObjectData = new List<ObjectStruct>();
  35.        
  36.         #endregion // Variables
  37.  
  38.         #region Functions
  39.  
  40.         /// <summary>
  41.         /// Attempts to load data and initialize the plugin.
  42.         /// </summary>
  43.         /// <returns>true if successful</returns>
  44.         /// <returns>false if unsuccessful</returns>
  45.         static public bool Init()
  46.         {
  47.             return ColAndreasInternal.Instance.Init();
  48.         }
  49.  
  50.         /// <summary>
  51.         /// Attempts to remove all the buildings from the world within the given radius.
  52.         /// </summary>
  53.         /// <param name="modelId">The object's model.</param>
  54.         /// <param name="x,y,z">The center point of the radius circle.</param>
  55.         /// <param name="radius">The radius to remove buildings.</param>
  56.         /// <returns>true if successful</returns>
  57.         /// <returns>false if unsuccessful</returns>
  58.         static public bool RemoveBuilding(int modelId, float x, float y, float z, float radius)
  59.         {
  60.             return ColAndreasInternal.Instance.RemoveBuilding(modelId, x, y, z, radius);
  61.         }
  62.         static public bool RemoveBuilding(int modelId, Vector3 center, float radius)
  63.         {
  64.             return ColAndreasInternal.Instance.RemoveBuilding(modelId, center.X, center.Y, center.Z, radius);
  65.         }
  66.  
  67.         /// <summary>
  68.         /// Attempts to detect collision.
  69.         /// </summary>
  70.         /// <param name="startX,startY,startZ">The starting point.</param>
  71.         /// <param name="endX,endY,endZ">The ending point.</param>
  72.         /// <param name="x,y,z">The resulting hit position.</param>
  73.         /// <returns>0 if nothing is detected.</returns>
  74.         /// <returns>WATER_MODEL if it hit water.</returns>
  75.         /// <returns>modelId if it made collision.</returns>
  76.         static public int RayCastLine(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z)
  77.         {
  78.             return ColAndreasInternal.Instance.RayCastLine(startX, startY, startZ, endX, endY, endZ, out x, out y, out z);
  79.         }
  80.         static public int RayCastLine(Vector3 start, Vector3 end, out Vector3 hit)
  81.         {
  82.             int modelId = ColAndreasInternal.Instance.RayCastLine(start.X, start.Y, start.Z, end.X, end.Y, end.Z, out float x, out float y, out float z);
  83.  
  84.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  85.             return modelId;
  86.         }
  87.  
  88.         /// <summary>
  89.         /// Attempts to detect collision with dynamic object (ColAndreas.CreateObject).
  90.         /// </summary>
  91.         /// <param name="startX,startY,startZ">The starting point.</param>
  92.         /// <param name="endX,endY,endZ">The ending point.</param>
  93.         /// <param name="x,y,z">The resulting hit position.</param>
  94.         /// <returns>-1 if collided with static object or water.</returns>
  95.         /// <returns>0 if didn't collide with anything.</returns>
  96.         /// <returns>collisionId if it made collision.</returns>
  97.         static public int RayCastLineId(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z)
  98.         {
  99.             return ColAndreasInternal.Instance.RayCastLineId(startX, startY, startZ, endX, endY, endZ, out x, out y, out z);
  100.         }
  101.         static public int RayCastLineId(Vector3 start, Vector3 end, out Vector3 hit)
  102.         {
  103.             int modelId = ColAndreasInternal.Instance.RayCastLineId(start.X, start.Y, start.Z, end.X, end.Y, end.Z, out float x, out float y, out float z);
  104.  
  105.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  106.             return modelId;
  107.         }
  108.  
  109.         /// <summary>
  110.         /// Attempts to detect collision with object that has ExtraId (ColAndreas.CreateObject).
  111.         /// </summary>
  112.         /// <param name="startX,startY,startZ">The starting point.</param>
  113.         /// <param name="endX,endY,endZ">The ending point.</param>
  114.         /// <param name="x,y,z">The resulting hit position.</param>
  115.         /// <returns>-1 if collided with static object or water.</returns>
  116.         /// <returns>-1 if collided with object that has no extra id.</returns>
  117.         /// <returns>0 if didn't collide with anything.</returns>
  118.         /// <returns>collisionId if it made collision.</returns>
  119.         static public int RayCastLineExtraId(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z)
  120.         {
  121.             return ColAndreasInternal.Instance.RayCastLineExtraId(startX, startY, startZ, endX, endY, endZ, out x, out y, out z);
  122.         }
  123.         static public int RayCastLineExtraId(Vector3 start, Vector3 end, out Vector3 hit)
  124.         {
  125.             int modelId = ColAndreasInternal.Instance.RayCastLineExtraId(start.X, start.Y, start.Z, end.X, end.Y, end.Z, out float x, out float y, out float z);
  126.  
  127.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  128.             return modelId;
  129.         }
  130.  
  131.         /// <summary>
  132.         /// Attempts to detect collision with objects.
  133.         /// </summary>
  134.         /// <param name="startX,startY,startZ">The starting point.</param>
  135.         /// <param name="endX,endY,endZ">The ending point.</param>
  136.         /// <param name="x[],y[],z[]">The resulting hit positions.</param>
  137.         /// <param name="distance[]">The resulting distance of each hit.</param>
  138.         /// <param name="modelId[]">The resulting modelIds of each hit.</param>
  139.         /// <param name="size">The maximum array size.</param>
  140.         /// <returns>-1 it hit more objects than allowed by size.</returns>
  141.         /// <returns>0 if didn't collide with anything.</returns>
  142.         /// <returns>1+ the number of objects it hit.</returns>
  143.         static public int RayCastMultiLine(float startX, float startY, float startZ, float endX, float endY, float endZ, out float[] x, out float[] y, out float[] z, out float[] distance, out int[] modelId, int size)
  144.         {
  145.             return ColAndreasInternal.Instance.RayCastMultiLine(startX, startY, startZ, endX, endY, endZ, out x, out y, out z, out distance, out modelId, size);
  146.         }
  147.         static public int RayCastMultiLine(Vector3 start, Vector3 end, out Vector3[] positions, out float[] distances, out int[] modelIds, int arraySize)
  148.         {
  149.             positions = new Vector3[arraySize];
  150.  
  151.             int count = ColAndreasInternal.Instance.RayCastMultiLine(
  152.                 start.X, start.Y, start.Z, end.X, end.Y, end.Z,
  153.                 out float[] x, out float[] y, out float[] z, out distances, out modelIds, arraySize
  154.             );
  155.  
  156.             for(int i = 0; i < count; i++)
  157.             {
  158.                 positions[i] = new Vector3(x[i], y[i], z[i]);
  159.             }
  160.             return count;
  161.         }
  162.  
  163.         /// <summary>
  164.         /// Attempts to detect collision with object, gives the rotation.
  165.         /// </summary>
  166.         /// <param name="startX,startY,startZ">The starting point.</param>
  167.         /// <param name="endX,endY,endZ">The ending point.</param>
  168.         /// <param name="x,y,z">The resulting hit position.</param>
  169.         /// <param name="rx,ry,rz">The resulting hit rotation.</param>
  170.         /// <returns>0 if didn't collide with anything.</returns>
  171.         /// <returns>WATER_MODEL if it hit water.</returns>
  172.         /// <returns>modelId if it made collision.</returns>
  173.         static public int RayCastLineAngle(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float rx, out float ry, out float rz)
  174.         {
  175.             return ColAndreasInternal.Instance.RayCastLineAngle(startX, startY, startZ, endX, endY, endZ, out x, out y, out z, out rx, out ry, out rz);
  176.         }
  177.         static public int RayCastLineAngle(Vector3 start, Vector3 end, out Vector3 hit, out Vector3 hitRotation)
  178.         {
  179.             int modelId = ColAndreasInternal.Instance.RayCastLineAngle(
  180.                 start.X, start.Y, start.Z, end.X, end.Y, end.Z,
  181.                 out float x, out float y, out float z, out float rx, out float ry, out float rz
  182.             );
  183.  
  184.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  185.             hitRotation = (modelId == 0) ? Vector3.Zero : new Vector3(rx, ry, rz);
  186.             return modelId;
  187.         }
  188.  
  189.         /// <summary>
  190.         /// Attempts to detect collision with object, gives quaternion and position of object.
  191.         /// </summary>
  192.         /// <param name="startX,startY,startZ">The starting point.</param>
  193.         /// <param name="endX,endY,endZ">The ending point.</param>
  194.         /// <param name="x,y,z">The point that the ray collided.</param>
  195.         /// <param name="rx,ry,rz,rw">The quaternion rotation of the object that the ray collided.</param>
  196.         /// <param name="cx,cy,cz">The position of the object that the ray collided.</param>
  197.         /// <returns>0 if didn't collide with anything.</returns>
  198.         /// <returns>WATER_MODEL if it hit water.</returns>
  199.         /// <returns>modelId if it made collision.</returns>
  200.         static public int RayCastLineEx(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float rx, out float ry, out float rz, out float rw, out float cx, out float cy, out float cz)
  201.         {
  202.             return ColAndreasInternal.Instance.RayCastLineEx(startX, startY, startZ, endX, endY, endZ, out x, out y, out z, out rx, out ry, out rz, out rw, out cx, out cy, out cz);
  203.         }
  204.         static public int RayCastLineEx(Vector3 start, Vector3 end, out Vector3 hit, out Vector4 quaternion, out Vector3 position)
  205.         {
  206.             int modelId = ColAndreasInternal.Instance.RayCastLineEx(
  207.                 start.X, start.Y, start.Z, end.X, end.Y, end.Z,
  208.                 out float x, out float y, out float z,
  209.                 out float rx, out float ry, out float rz, out float rw,
  210.                 out float cx, out float cy, out float cz
  211.             );
  212.            
  213.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  214.             quaternion = (modelId == 0) ? Vector4.Zero : new Vector4(rx, ry, rz, rw);
  215.             position = (modelId == 0) ? Vector3.Zero : new Vector3(cx, cy, cz);
  216.             return modelId;
  217.         }
  218.  
  219.         /// <summary>
  220.         /// Attempts to detect collision with object, gives position and rotation of object.
  221.         /// </summary>
  222.         /// <param name="startX,startY,startZ">The starting point.</param>
  223.         /// <param name="endX,endY,endZ">The ending point.</param>
  224.         /// <param name="x,y,z">The point that the ray collided.</param>
  225.         /// <param name="rx,ry,rz">The rotation of the face that the ray collided.</param>
  226.         /// <param name="ocx,ocy,ocz">The position of the object that the ray collided.</param>
  227.         /// <param name="orx,ory,orz">The rotation of the object that the ray collided.</param>
  228.         /// <returns>0 if didn't collide with anything.</returns>
  229.         /// <returns>WATER_MODEL if it hit water.</returns>
  230.         /// <returns>modelId if it made collision.</returns>
  231.         static public int RayCastLineAngleEx(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float rx, out float ry, out float rz, out float ocx, out float ocy, out float ocz, out float orx, out float ory, out float orz)
  232.         {
  233.             return ColAndreasInternal.Instance.RayCastLineAngleEx(startX, startY, startZ, endX, endY, endZ, out x, out y, out z, out rx, out ry, out rz, out ocx, out ocy, out ocz, out orx, out ory, out orz);
  234.         }
  235.         static public int RayCastLineAngleEx(Vector3 start, Vector3 end, out Vector3 hit, out Vector3 surfaceRotation, out Vector3 position, out Vector3 rotation)
  236.         {
  237.             int modelId = ColAndreasInternal.Instance.RayCastLineAngleEx(
  238.                 start.X, start.Y, start.Z, end.X, end.Y, end.Z,
  239.                 out float x, out float y, out float z,
  240.                 out float rx, out float ry, out float rz,
  241.                 out float ocx, out float ocy, out float ocz,
  242.                 out float orx, out float ory, out float orz
  243.             );
  244.  
  245.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  246.             surfaceRotation = (modelId == 0) ? Vector3.Zero : new Vector3(rx, ry, rz);
  247.             position = (modelId == 0) ? Vector3.Zero : new Vector3(ocx, ocy, ocz);
  248.             rotation = (modelId == 0) ? Vector3.Zero : new Vector3(orx, ory, orz);
  249.             return modelId;
  250.         }
  251.  
  252.         /// <summary>
  253.         /// Get the reflection vector of the detected collision object.
  254.         /// </summary>
  255.         /// <param name="startX,startY,startZ">The starting point.</param>
  256.         /// <param name="endX,endY,endZ">The ending point.</param>
  257.         /// <param name="x,y,z">The point the ray collided at.</param>
  258.         /// <param name="nx,ny,nz">The reflection vector of the face the ray collided.</param>
  259.         /// <returns>0 if didn't collide with anything.</returns>
  260.         /// <returns>WATER_MODEL if it hit water.</returns>
  261.         /// <returns>modelId if it made collision.</returns>
  262.         static public int RayCastReflectionVector(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float nx, out float ny, out float nz)
  263.         {
  264.             return ColAndreasInternal.Instance.RayCastReflectionVector(startX, startY, startZ, endX, endY, endZ, out x, out y, out z, out nx, out ny, out nz);
  265.         }
  266.         static public int RayCastReflectionVector(Vector3 start, Vector3 end, out Vector3 hit, out Vector3 reflectionVector)
  267.         {
  268.             int modelId = ColAndreasInternal.Instance.RayCastReflectionVector(
  269.                 start.X, start.Y, start.Z, end.X, end.Y, end.Z,
  270.                 out float x, out float y, out float z, out float nx, out float ny, out float nz
  271.             );
  272.  
  273.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  274.             reflectionVector = (modelId == 0) ? Vector3.Zero : new Vector3(nx, ny, nz);
  275.             return modelId;
  276.         }
  277.  
  278.         /// <summary>
  279.         /// Get the surface normal of the detected collision object.
  280.         /// </summary>
  281.         /// <param name="startX,startY,startZ">The starting point.</param>
  282.         /// <param name="endX,endY,endZ">The ending point.</param>
  283.         /// <param name="x,y,z">The point the ray collided at.</param>
  284.         /// <param name="nx,ny,nz">The surface normal of the face the ray collided.</param>
  285.         /// <returns>0 if didn't collide with anything.</returns>
  286.         /// <returns>WATER_MODEL if it hit water.</returns>
  287.         /// <returns>modelId if it made collision.</returns>
  288.         static public int RayCastLineNormal(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float nx, out float ny, out float nz)
  289.         {
  290.             return ColAndreasInternal.Instance.RayCastLineNormal(startX, startY, startZ, endX, endY, endZ, out x, out y, out z, out nx, out ny, out nz);
  291.         }
  292.         static public int RayCastLineNormal(Vector3 start, Vector3 end, out Vector3 hit, out Vector3 surfaceNormal)
  293.         {
  294.             int modelId = ColAndreasInternal.Instance.RayCastLineNormal(
  295.                 start.X, start.Y, start.Z, end.X, end.Y, end.Z,
  296.                 out float x, out float y, out float z, out float nx, out float ny, out float nz
  297.             );
  298.  
  299.             hit = (modelId == 0) ? Vector3.Zero : new Vector3(x, y, z);
  300.             surfaceNormal = (modelId == 0) ? Vector3.Zero : new Vector3(nx, ny, nz);
  301.             return modelId;
  302.         }
  303.  
  304.         /// <summary>
  305.         /// Tests whether the object collides with the world.
  306.         /// </summary>
  307.         /// <param name="modelId">The model of the object to test.</param>
  308.         /// <param name="x,y,z">The position of the object to test.</param>
  309.         /// <param name="rx,ry,rz">The rotation of the object to test.</param>
  310.         /// <returns>0 doesn't collide with the world.</returns>
  311.         /// <returns>1 collides with the world.</returns>
  312.         static public int ContactTest(int modelId, float x, float y, float z, float rx, float ry, float rz)
  313.         {
  314.             return ColAndreasInternal.Instance.ContactTest(modelId, x, y, z, rx, ry, rz);
  315.         }
  316.         static public int ContactTest(int modelId, Vector3 position, Vector3 rotation)
  317.         {
  318.             return ColAndreasInternal.Instance.ContactTest(modelId, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z);
  319.         }
  320.  
  321.         /// <summary>
  322.         /// Converts GTA euler rotations to quaternion angles.
  323.         /// </summary>
  324.         /// <param name="rx,ry,rz">GTA euler rotation to be converted</param>
  325.         /// <param name="x,y,z,w">The quaternion angles returned</param>
  326.         /// <returns>Always 1</returns>
  327.         static public int EulerToQuat(float rx, float ry, float rz, out float x, out float y, out float z, out float w)
  328.         {
  329.             return ColAndreasInternal.Instance.EulerToQuat(rx, ry, rz, out x, out y, out z, out w);
  330.         }
  331.         static public int EulerToQuat(Vector3 rotation, out Vector4 quaternion)
  332.         {
  333.             int result = ColAndreasInternal.Instance.EulerToQuat(
  334.                 rotation.X, rotation.Y, rotation.Z,
  335.                 out float x, out float y, out float z, out float w
  336.             );
  337.  
  338.             quaternion = new Vector4(x, y, z, w);
  339.             return result;
  340.         }
  341.  
  342.         /// <summary>
  343.         /// Converts quaternion angles to GTA euler rotation.
  344.         /// </summary>
  345.         /// <param name="x,y,z,w">The quaternion angles to be converted</param>
  346.         /// <param name="rx,ry,rz">GTA euler rotation returned</param>
  347.         /// <returns>Always 1</returns>
  348.         static public int QuatToEuler(Vector4 quaternion, out Vector3 rotation)
  349.         {
  350.             int result = ColAndreasInternal.Instance.QuatToEuler(
  351.                 quaternion.X, quaternion.Y, quaternion.Z, quaternion.W,
  352.                 out float x, out float y, out float z
  353.             );
  354.  
  355.             rotation = new Vector3(x, y, z);
  356.             return result;
  357.         }
  358.  
  359.         /// <summary>
  360.         /// Gets the bounding sphere of the modelId.
  361.         /// </summary>
  362.         /// <param name="modelId">The modelId of the object</param>
  363.         /// <param name="offsetX,offsetY,offsetZ">The retrieved offset from it's position.</param>
  364.         /// <param name="radius">The radius of the sphere.</param>
  365.         /// <returns>0 if modelId is invalid</returns>
  366.         /// <returns>1 if successful</returns>
  367.         static public int GetModelBoundingSphere(int modelId, out float offsetX, out float offsetY, out float offsetZ, out float radius)
  368.         {
  369.             return ColAndreasInternal.Instance.GetModelBoundingSphere(modelId, out offsetX, out offsetY, out offsetZ, out radius);
  370.         }
  371.         static public int GetModelBoundingSphere(int modelId, out Vector3 offset, out float radius)
  372.         {
  373.             int result = ColAndreasInternal.Instance.GetModelBoundingSphere(
  374.                 modelId,
  375.                 out float offsetX, out float offsetY, out float offsetZ, out radius
  376.             );
  377.  
  378.             offset = new Vector3(offsetX, offsetY, offsetZ);
  379.             return result;
  380.         }
  381.  
  382.         /// <summary>
  383.         /// Gets the bounding box of the modelId.
  384.         /// </summary>
  385.         /// <param name="modelId">The modelId of the object</param>
  386.         /// <param name="minX,minY,minZ">The retrieved point of the one side of the box</param>
  387.         /// <param name="maxX,maxY,maxZ">The retrieved point of the other side of the box</param>
  388.         /// <returns>0 if modelId is invalid</returns>
  389.         /// <returns>1 if successful</returns>
  390.         static public int GetModelBoundingBox(int modelId, out float minX, out float minY, out float minZ, out float maxX, out float maxY, out float maxZ)
  391.         {
  392.             return ColAndreasInternal.Instance.GetModelBoundingBox(modelId, out minX, out minY, out minZ, out maxX, out maxY, out maxZ);
  393.         }
  394.         static public int GetModelBoundingBox(int modelId, out Vector3 min, out Vector3 max)
  395.         {
  396.             int result = ColAndreasInternal.Instance.GetModelBoundingBox(
  397.                 modelId,
  398.                 out float minX, out float minY, out float minZ,
  399.                 out float maxX, out float maxY, out float maxZ
  400.             );
  401.  
  402.             min = new Vector3(minX, minY, minZ);
  403.             max = new Vector3(maxX, maxY, maxZ);
  404.             return result;
  405.         }
  406.  
  407.         /// <summary>
  408.         /// Creates a collision object, this is not a physical object.
  409.         /// </summary>
  410.         /// <param name="modelId">The modelId of the collision object.</param>
  411.         /// <param name="x,y,z">The position of the collision object.</param>
  412.         /// <param name="rx,ry,rz">The rotation of the collision object.</param>
  413.         /// <param name="index">Whether or not to index this for further modifications.</param>
  414.         /// <returns>-1 if too many collision objects.</returns>
  415.         /// <returns>-1 if index is set to false.</returns>
  416.         /// <returns>collisionId if successful.</returns>
  417.         static public int CreateObject(int modelId, float x, float y, float z, float rx, float ry, float rz, bool index = false)
  418.         {
  419.             return ColAndreasInternal.Instance.CreateObject(modelId, x, y, z, rx, ry, rz, index);
  420.         }
  421.         static public int CreateObject(int modelId, Vector3 position, Vector3 rotation, bool index = false)
  422.         {
  423.             return ColAndreasInternal.Instance.CreateObject(modelId, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z, index);
  424.         }
  425.  
  426.         /// <summary>
  427.         /// Removes a collision object.
  428.         /// </summary>
  429.         /// <param name="collisionId">The collisionId of the object.</param>
  430.         /// <returns>-1 if the specified model has no collision.</returns>
  431.         /// <returns>-1 if it's not managed.</returns>
  432.         /// <returns>The collisionId of the collision object.</returns>
  433.         static public int DestroyObject(int collisionId)
  434.         {
  435.             return ColAndreasInternal.Instance.DestroyObject(collisionId);
  436.         }
  437.  
  438.         /// <summary>
  439.         /// Sets the collision object's position.
  440.         /// </summary>
  441.         /// <param name="collisionId">The collisionId of the object.</param>
  442.         /// <param name="x,y,z">The position to set.</param>
  443.         /// <returns>0 Invalid object.</returns>
  444.         /// <returns>1 Successful.</returns>
  445.         static public int SetObjectPos(int collisionId, float x, float y, float z)
  446.         {
  447.             return ColAndreasInternal.Instance.SetObjectPos(collisionId, x, y, z);
  448.         }
  449.         static public int SetObjectPos(int collisionId, Vector3 position)
  450.         {
  451.             return ColAndreasInternal.Instance.SetObjectPos(collisionId, position.X, position.Y, position.Z);
  452.         }
  453.  
  454.         /// <summary>
  455.         /// Sets the collision object's rotation.
  456.         /// </summary>
  457.         /// <param name="collisionId">The collisionId of the object.</param>
  458.         /// <param name="rx,ry,rz">The rotation to set.</param>
  459.         /// <returns>0 Invalid object.</returns>
  460.         /// <returns>1 Successful.</returns>
  461.         static public int SetObjectRot(int collisionId, float rx, float ry, float rz)
  462.         {
  463.             return ColAndreasInternal.Instance.SetObjectRot(collisionId, rx, ry, rz);
  464.         }
  465.         static public int SetObjectRot(int collisionId, Vector3 rotation)
  466.         {
  467.             return ColAndreasInternal.Instance.SetObjectPos(collisionId, rotation.X, rotation.Y, rotation.Z);
  468.         }
  469.  
  470.         /// <summary>
  471.         /// Sets custom data for the collision object.
  472.         /// </summary>
  473.         /// <param name="collisionId">The collisionId of the object.</param>
  474.         /// <param name="key"></param>
  475.         /// <param name="value"></param>
  476.         /// <returns>Always 1</returns>
  477.         static public int SetObjectExtraID(int collisionId, int key, int value)
  478.         {
  479.             return ColAndreasInternal.Instance.SetObjectExtraID(collisionId, key, value);
  480.         }
  481.  
  482.         /// <summary>
  483.         /// Gets custom data for the collision object.
  484.         /// </summary>
  485.         /// <param name="collisionId">The collisionId of the object.</param>
  486.         /// <param name="key"></param>
  487.         /// <returns>The value of the collision object data.</returns>
  488.         static public int GetObjectExtraID(int collisionId, int key)
  489.         {
  490.             return ColAndreasInternal.Instance.GetObjectExtraID(collisionId, key);
  491.         }
  492.  
  493.         static ObjectStruct GetData(GlobalObject obj)
  494.         {
  495.             foreach(ObjectStruct objectData in ObjectData)
  496.             {
  497.                 if(objectData.Object == obj)
  498.                 {
  499.                     return objectData;
  500.                 }
  501.             }
  502.             return null;
  503.         }
  504.  
  505.         /// <summary>
  506.         /// Creates a physical object with the collision object.
  507.         /// </summary>
  508.         /// <param name="modelId">The model of the object.</param>
  509.         /// <param name="x,y,z">The position of the object.</param>
  510.         /// <param name="rx,ry,rz">The rotation of the object.</param>
  511.         /// <param name="streamDistance">The distance it appears for the player</param>
  512.         /// <returns>null if unsuccessful</returns>
  513.         /// <returns>GlobalObject if successful</returns>
  514.         static public GlobalObject CreateObject(int modelId, float x, float y, float z, float rx, float ry, float rz, float streamDistance = 300.0f)
  515.         {
  516.             GlobalObject obj = new GlobalObject(modelId, new Vector3(x, y, z), new Vector3(rx, ry, rz), streamDistance);
  517.  
  518.             if(obj == null)
  519.             {
  520.                 return null;
  521.             }
  522.  
  523.             int collisionId = CreateObject(modelId, x, y, z, rx, ry, rz, true);
  524.  
  525.             if(collisionId == -1)
  526.             {
  527.                 obj.Dispose();
  528.                 return null;
  529.             }
  530.  
  531.             ObjectStruct objectData = new ObjectStruct
  532.             {
  533.                 Object = obj,
  534.                 CollisionId = collisionId,
  535.                 Type = ObjectType.Normal
  536.             };
  537.             ObjectData.Add(objectData);
  538.             return obj;
  539.         }
  540.         static public GlobalObject CreateObject(int modelId, Vector3 position, Vector3 rotation, float streamDistance = 300.0f)
  541.         {
  542.             return CreateObject(modelId, position.X, position.Y, position.Z, rotation.X, rotation.Y, rotation.Z, streamDistance);
  543.         }
  544.  
  545.         /// <summary>
  546.         /// Destroys the physical and collision object.
  547.         /// </summary>
  548.         /// <param name="GlobalObject">The instance of the GlobalObject</param>
  549.         /// <returns>false if unsuccessful</returns>
  550.         /// <returns>true if successful</returns>
  551.         static public bool DestroyObject(GlobalObject obj)
  552.         {
  553.             ObjectStruct objectData = GetData(obj);
  554.  
  555.             if(objectData == null)
  556.             {
  557.                 return false;
  558.             }
  559.  
  560.             DestroyObject(objectData.CollisionId);
  561.             obj.Dispose();
  562.             ObjectData.Remove(objectData);
  563.             return true;
  564.         }
  565.  
  566.         /// <summary>
  567.         /// Sets the position of the physical and collision object.
  568.         /// </summary>
  569.         /// <param name="obj"></param>
  570.         /// <param name="position"></param>
  571.         /// <returns></returns>
  572.         static public bool SetObjectPos(GlobalObject obj, Vector3 position)
  573.         {
  574.             ObjectStruct objectData = GetData(obj);
  575.  
  576.             if(objectData == null)
  577.             {
  578.                 return false;
  579.             }
  580.  
  581.             SetObjectPos(objectData.CollisionId, position.X, position.Y, position.Z);
  582.             obj.Position = position;
  583.             return true;
  584.         }
  585.  
  586.         /// <summary>
  587.         /// Sets the rotation of the physical and collision object.
  588.         /// </summary>
  589.         /// <param name="obj"></param>
  590.         /// <param name="rotation"></param>
  591.         /// <returns></returns>
  592.         static public bool SetObjectRot(GlobalObject obj, Vector3 rotation)
  593.         {
  594.             ObjectStruct objectData = GetData(obj);
  595.  
  596.             if (objectData == null)
  597.             {
  598.                 return false;
  599.             }
  600.  
  601.             SetObjectRot(objectData.CollisionId, rotation.X, rotation.Y, rotation.Z);
  602.             obj.Rotation = rotation;
  603.             return true;
  604.         }
  605.  
  606.         /// <summary>
  607.         /// Destroys all the physical and collision objects.
  608.         /// </summary>
  609.         /// <returns></returns>
  610.         static public bool DestroyObjects()
  611.         {
  612.             foreach(ObjectStruct objectData in ObjectData)
  613.             {
  614.                 DestroyObject(objectData.Object);
  615.             }
  616.             return true;
  617.         }
  618.  
  619.         /// <summary>
  620.         /// ColAndreas wrapper for the MapAndreas function.
  621.         /// </summary>
  622.         /// <param name="x,y,z"></param>
  623.         /// <returns></returns>
  624.         static public bool FindZ_For2DCoord(float x, float y, out float z)
  625.         {
  626.             if (RayCastLine(x, y, 700.0f, x, y, -1000.0f, out x, out y, out z) <= 0)
  627.             {
  628.                 return false;
  629.             }
  630.             return true;
  631.         }
  632.         static public bool FindZ_For2DCoord(Vector2 xy, out float z)
  633.         {
  634.             if (RayCastLine(xy.X, xy.Y, 700.0f, xy.X, xy.Y, -1000.0f, out float x, out float y, out z) <= 0)
  635.             {
  636.                 return false;
  637.             }
  638.             return true;
  639.         }
  640.         static public Vector3 FindZ_For2DCoord(Vector3 position)
  641.         {
  642.             if(RayCastLine(position.X, position.Y, 700.0f, position.X, position.Y, -1000.0f, out float x, out float y, out float z) <= 0)
  643.             {
  644.                 return Vector3.Zero;
  645.             }
  646.             return new Vector3(x, y, z);
  647.         }
  648.        
  649.         /// <summary>
  650.         /// Creates a sphere of detections with the x,y,z in the center.
  651.         /// </summary>
  652.         /// <param name="x,y,z">Center of the sphere.</param>
  653.         /// <param name="radius">The radius of the sphere.</param>
  654.         /// <param name="collisions">The detected collisions of the sphere.</param>
  655.         /// <param name="intensity">The intensity of the detections.</param>
  656.         /// <returns></returns>
  657.         static public int RayCastExplode(float x, float y, float z, float radius, out Vector3[] collisions, float intensity = 20.0f)
  658.         {
  659.             collisions = new Vector3[0];
  660.  
  661.             if(intensity < 1.0 || intensity > 360.0 || (((360.0 / intensity) - Math.Round((360.0 / intensity))) * intensity) != 0.0)
  662.             {
  663.                 return 0;
  664.             }
  665.            
  666.             List<Vector3> positions = new List<Vector3>();
  667.  
  668.             for(float lat = -180.0f; lat < 180.0f; lat += (intensity * 0.75f))
  669.             {
  670.                 for(float lon = -90.0f; lon < 90.0f; lon += intensity)
  671.                 {
  672.                     float LAT = (float)(lat * Math.PI / 180.0f);
  673.                     float LON = (float)(lon * Math.PI / 180.0f);
  674.                     float cX = (float)(-radius * Math.Cos(LAT) * Math.Cos(LON));
  675.                     float cY = (float)(radius * Math.Cos(LAT) * Math.Sin(LON));
  676.                     float cZ = (float)(radius * Math.Sin(LAT));
  677.  
  678.                     if(RayCastLine(x, y, z, x + cX, y + cY, z + cZ, out cX, out cY, out cZ) <= 0) continue;
  679.                    
  680.                     positions.Add(new Vector3(cX, cY, cZ));
  681.                 }
  682.             }
  683.  
  684.             collisions = positions.ToArray();
  685.             return positions.Count;
  686.         }
  687.  
  688.         /// <summary>
  689.         /// Checks if there's a collision below the player.
  690.         /// </summary>
  691.         /// <param name="player">The player.</param>
  692.         /// <param name="tolerance"></param>
  693.         /// <returns>true if they're on top of something.</returns>
  694.         /// <returns>false if they're not.</returns>
  695.         static public bool IsPlayerOnSurface(BasePlayer player, float tolerance = 1.5f)
  696.         {
  697.             Vector3 position = player.Position;
  698.  
  699.             if(RayCastLine(position.X, position.Y, position.Z, position.X, position.Y, (position.Z - tolerance), out float x, out float y, out float z) <= 0)
  700.             {
  701.                 return false;
  702.             }
  703.             return true;
  704.         }
  705.  
  706.         /// <summary>
  707.         /// Removes any barrier object from the game.
  708.         /// </summary>
  709.         /// <returns></returns>
  710.         static public bool RemoveBarriers()
  711.         {
  712.             int[] barrierIds =
  713.             {
  714.                 16439, 16438, 16437, 16436, 4527, 4526, 4525, 4524, 4523, 4517,
  715.                 4516, 4515, 4514, 4513, 4512, 4511, 4510, 4509, 4508, 4507,
  716.                 4506, 4505, 4504, 1662
  717.             };
  718.  
  719.             for(int i = 0, l = barrierIds.Length; i < l; i++)
  720.             {
  721.                 RemoveBuilding(barrierIds[i], 0.0f, 0.0f, 0.0f, 4242.6407f);
  722.             }
  723.             return true;
  724.         }
  725.  
  726.         /// <summary>
  727.         /// Removes all the breakable objects in the game.
  728.         /// </summary>
  729.         /// <returns></returns>
  730.         static public bool RemoveBreakableBuildings()
  731.         {
  732.             int[] breakableIds =
  733.             {
  734.                 625, 626, 627, 628, 629, 630, 631, 632, 633, 642,
  735.                 643, 644, 646, 650, 716, 717, 737, 738, 792, 858,
  736.                 881, 882, 883, 884, 885, 886, 887, 888, 889, 890,
  737.                 891, 892, 893, 894, 895, 904, 905, 941, 955, 956,
  738.                 959, 961, 990, 993, 996, 1209, 1211, 1213, 1219, 1220,
  739.                 1221, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231,
  740.                 1232, 1235, 1238, 1244, 1251, 1255, 1257, 1262, 1264, 1265,
  741.                 1270, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288,
  742.                 1289, 1290, 1291, 1293, 1294, 1297, 1300, 1302, 1315, 1328,
  743.                 1329, 1330, 1338, 1350, 1351, 1352, 1370, 1373, 1374, 1375,
  744.                 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1417,
  745.                 1418, 1419, 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1428,
  746.                 1429, 1431, 1432, 1433, 1436, 1437, 1438, 1440, 1441, 1443,
  747.                 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1456,
  748.                 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466,
  749.                 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1475, 1476,
  750.                 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1514, 1517, 1520,
  751.                 1534, 1543, 1544, 1545, 1551, 1553, 1554, 1558, 1564, 1568,
  752.                 1582, 1583, 1584, 1588, 1589, 1590, 1591, 1592, 1645, 1646,
  753.                 1647, 1654, 1664, 1666, 1667, 1668, 1669, 1670, 1672, 1676,
  754.                 1684, 1686, 1775, 1776, 1949, 1950, 1951, 1960, 1961, 1962,
  755.                 1975, 1976, 1977, 2647, 2663, 2682, 2683, 2885, 2886, 2887,
  756.                 2900, 2918, 2920, 2925, 2932, 2933, 2942, 2943, 2945, 2947,
  757.                 2958, 2959, 2966, 2968, 2971, 2977, 2987, 2988, 2989, 2991,
  758.                 2994, 3006, 3018, 3019, 3020, 3021, 3022, 3023, 3024, 3029,
  759.                 3032, 3036, 3058, 3059, 3067, 3083, 3091, 3221, 3260, 3261,
  760.                 3262, 3263, 3264, 3265, 3267, 3275, 3276, 3278, 3280, 3281,
  761.                 3282, 3302, 3374, 3409, 3460, 3516, 3794, 3795, 3797, 3853,
  762.                 3855, 3864, 3884, 11103, 12840, 16627, 16628, 16629, 16630, 16631,
  763.                 16632, 16633, 16634, 16635, 16636, 16732, 17968
  764.             };
  765.  
  766.             for(int i = 0, l = breakableIds.Length; i < l; i++)
  767.             {
  768.                 RemoveBuilding(breakableIds[i], 0.0f, 0.0f, 0.0f, 4242.6407f);
  769.             }
  770.             return true;
  771.         }
  772.  
  773.         /// <summary>
  774.         /// Checks if the player is in water.
  775.         /// </summary>
  776.         /// <param name="player"></param>
  777.         /// <param name="depth"></param>
  778.         /// <param name="playerDepth"></param>
  779.         /// <returns></returns>
  780.         static public bool IsPlayerInWater(BasePlayer player, out float depth, out float playerDepth)
  781.         {
  782.             Vector3 position = player.Position;
  783.  
  784.             depth = float.NaN;
  785.             playerDepth = float.NaN;
  786.  
  787.             int count = RayCastMultiLine(
  788.                 position.X, position.Y, (position.Z + 1000.0f), position.X, position.Y, (position.Y - 1000.0f),
  789.                 out float[] x, out float[] y, out float[] z, out float[] distance, out int[] modelId, 10
  790.             );
  791.  
  792.             if(count <= 0)
  793.             {
  794.                 return false;
  795.             }
  796.  
  797.             for(int i = 0; i < count; i++)
  798.             {
  799.                 if(modelId[i] != WATER_MODEL) continue;
  800.  
  801.                 for(int j = 0; j < count; j++)
  802.                 {
  803.                     if(z[j] < depth)
  804.                     {
  805.                         depth = z[j];
  806.                     }
  807.                 }
  808.  
  809.                 depth = z[i] - depth;
  810.  
  811.                 if(depth < 0.001f && depth > -0.001f)
  812.                 {
  813.                     depth = 100.0f;
  814.                 }
  815.  
  816.                 playerDepth = z[i] - position.Z;
  817.  
  818.                 if(playerDepth < -2.0)
  819.                 {
  820.                     return false;
  821.                 }
  822.                 return true;
  823.             }
  824.             return false;
  825.         }
  826.        
  827.         /// <summary>
  828.         /// Checks if the player is near any water source.
  829.         /// </summary>
  830.         /// <param name="player"></param>
  831.         /// <param name="distance"></param>
  832.         /// <param name="height"></param>
  833.         /// <returns></returns>
  834.         static public bool IsPlayerNearWater(BasePlayer player, float distance = 3.0f, float height = 3.0f)
  835.         {
  836.             // Modified by Ikkentim
  837.             for(float angle = 0; angle < (float)(Math.PI * 2); angle += (float)(Math.PI / 3))
  838.             {
  839.                 Matrix rotation = Matrix.CreateRotationZ(angle);
  840.                 Vector3 offset = Vector3.Transform(Vector3.Forward * distance, rotation);
  841.                 Vector3 start = player.Position + offset + Vector3.Up * height;
  842.                 Vector3 end = player.Position + offset - Vector3.Up * height;
  843.  
  844.                 if(RayCastLine(start, end, out Vector3 hit) == WATER_MODEL)
  845.                 {
  846.                     return true;
  847.                 }
  848.             }
  849.             return false;
  850.         }
  851.        
  852.         /// <summary>
  853.         /// Checks if the water is in front of the player.
  854.         /// </summary>
  855.         /// <param name="player"></param>
  856.         /// <param name="maxDistance"></param>
  857.         /// <param name="height"></param>
  858.         /// <returns></returns>
  859.         static public bool IsPlayerFacingWater(BasePlayer player, float maxDistance = 10.0f, float height = 5.0f)
  860.         {
  861.             Vector3 position = player.Position;
  862.             float angle = (player.InAnyVehicle) ? player.Vehicle.Angle : player.Angle;
  863.  
  864.             Matrix rotation = Matrix.CreateRotationZ(angle);
  865.  
  866.             for(float distance = 1.0f; distance <= maxDistance; distance += 1.0f)
  867.             {
  868.                 Vector3 offset = Vector3.Transform(Vector3.Forward * distance, rotation);
  869.                 Vector3 start = position + offset + Vector3.Up * height;
  870.                 Vector3 end = position + offset - Vector3.Up * height;
  871.  
  872.                 if(RayCastLine(start, end, out Vector3 hit) == WATER_MODEL)
  873.                 {
  874.                     return true;
  875.                 }
  876.             }
  877.             return false;
  878.         }
  879.        
  880.         /// <summary>
  881.         /// Checks if there's any collision objects in front of the player.
  882.         /// </summary>
  883.         /// <param name="player"></param>
  884.         /// <param name="distance"></param>
  885.         /// <param name="height"></param>
  886.         /// <returns></returns>
  887.         static public bool IsPlayerBlocked(BasePlayer player, float distance = 1.5f, float height = 0.5f)
  888.         {
  889.             Vector3 position = player.Position;
  890.             float angle = (player.InAnyVehicle) ? player.Vehicle.Angle : player.Angle;
  891.  
  892.             height = height + 1.0f;
  893.  
  894.             Matrix rotation = Matrix.CreateRotationZ(angle);
  895.             Vector3 offset = Vector3.Transform(Vector3.Forward * distance, rotation);
  896.             Vector3 start = position + offset + Vector3.Up * height;
  897.             Vector3 end = position + offset - Vector3.Up * height;
  898.  
  899.             if(RayCastLine(start, end, out Vector3 hit) == WATER_MODEL)
  900.             {
  901.                 return false;
  902.             }
  903.             return true;
  904.         }
  905.  
  906.         /// <summary>
  907.         /// Gets the room's height, if inside a room.
  908.         /// </summary>
  909.         /// <param name="start"></param>
  910.         /// <returns></returns>
  911.         static public float GetRoomHeight(Vector3 start)
  912.         {
  913.             Vector3 end = new Vector3(start.X, start.Y, start.Z - 1000.0f);
  914.  
  915.             if(RayCastLine(start, end, out Vector3 floor) <= 0)
  916.             {
  917.                 return float.NaN;
  918.             }
  919.  
  920.             end = new Vector3(start.X, start.Y, start.Z + 1000.0f);
  921.  
  922.             if(RayCastLine(start, end, out Vector3 ceiling) <= 0)
  923.             {
  924.                 return float.NaN;
  925.             }
  926.             return floor.DistanceTo(ceiling);
  927.         }
  928.         /*
  929.         stock Float:CA_GetRoomCenter(Float:x, Float:y, Float:z, &Float:m_x, &Float:m_y)
  930.         {
  931.             new Float:pt1x, Float:pt1y,
  932.                 Float:pt2x, Float:pt2y,
  933.                 Float:pt3x, Float:pt3y,
  934.                 Float:tmp;
  935.  
  936.             if(!CA_RayCastLine(x, y, z, x + 1000.0 * floatcos(0.0, degrees), y + 1000.0 * floatsin(0.0, degrees), z, pt1x, pt1y, tmp) ||
  937.                 !CA_RayCastLine(x, y, z, x + 1000.0 * floatcos(120.0, degrees), y + 1000.0 * floatsin(120.0, degrees), z, pt2x, pt2y, tmp) ||
  938.                 !CA_RayCastLine(x, y, z, x + 1000.0 * floatcos(-120.0, degrees), y + 1000.0 * floatsin(-120.0, degrees), z, pt3x, pt3y, tmp))
  939.                 return -1.0;
  940.  
  941.             new Float:yDelta_a = pt2y - pt1y,
  942.                 Float:xDelta_a = pt2x - pt1x,
  943.                 Float:yDelta_b = pt3y - pt2y,
  944.                 Float:xDelta_b = pt3x - pt2x;
  945.  
  946.             if (floatabs(xDelta_a) <= 0.000000001 && floatabs(yDelta_b) <= 0.000000001) {
  947.                 m_x = 0.5 * (pt2x + pt3x);
  948.                 m_y = 0.5 * (pt1y + pt2y);
  949.                 return VectorSize(m_x - pt1x, m_y - pt1y, 0.0);
  950.             }
  951.  
  952.             new Float:aSlope = yDelta_a / xDelta_a,
  953.                 Float:bSlope = yDelta_b / xDelta_b;
  954.  
  955.             if (floatabs(aSlope-bSlope) <= 0.000000001)
  956.                 return -1.0;
  957.  
  958.             m_x = (aSlope * bSlope * (pt1y - pt3y) + bSlope * (pt1x + pt2x) - aSlope * (pt2x + pt3x)) / (2.0 * (bSlope - aSlope));
  959.             m_y = -1.0 * (m_x - (pt1x + pt2x) / 2.0) / aSlope + (pt1y + pt2y) / 2.0;
  960.  
  961.             return VectorSize(m_x - pt1x, m_y - pt1y, 0.0);
  962.         }
  963.         */
  964.         #endregion // Functions
  965.     }
  966.  
  967.     public class ColAndreasInternal : NativeObjectSingleton<ColAndreasInternal>
  968.     {
  969.         [NativeMethod(Function = "CA_Init")]
  970.         public virtual bool Init()
  971.         {
  972.             throw new NativeNotImplementedException();
  973.         }
  974.  
  975.         [NativeMethod(Function = "CA_RemoveBuilding")]
  976.         public virtual bool RemoveBuilding(int modelId, float x, float y, float z, float radius)
  977.         {
  978.             throw new NativeNotImplementedException();
  979.         }
  980.  
  981.         [NativeMethod(Function = "CA_RayCastLine")]
  982.         public virtual int RayCastLine(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z)
  983.         {
  984.             throw new NativeNotImplementedException();
  985.         }
  986.  
  987.         [NativeMethod(Function = "CA_RayCastLineId")]
  988.         public virtual int RayCastLineId(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z)
  989.         {
  990.             throw new NativeNotImplementedException();
  991.         }
  992.  
  993.         [NativeMethod(Function = "CA_RayCastLineExtraID")]
  994.         public virtual int RayCastLineExtraId(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z)
  995.         {
  996.             throw new NativeNotImplementedException();
  997.         }
  998.  
  999.         [NativeMethod(11, 11, 11, 11, 11, Function = "CA_RayCastMultiLine")]
  1000.         public virtual int RayCastMultiLine(float startX, float startY, float startZ, float endX, float endY, float endZ, out float[] x, out float[] y, out float[] z, out float[] distance, out int[] modelId, int size)
  1001.         {
  1002.             throw new NativeNotImplementedException();
  1003.         }
  1004.  
  1005.         [NativeMethod(Function = "CA_RayCastLineAngle")]
  1006.         public virtual int RayCastLineAngle(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float rx, out float ry, out float rz)
  1007.         {
  1008.             throw new NativeNotImplementedException();
  1009.         }
  1010.  
  1011.         [NativeMethod(Function = "CA_RayCastReflectionVector")]
  1012.         public virtual int RayCastReflectionVector(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float nx, out float ny, out float nz)
  1013.         {
  1014.             throw new NativeNotImplementedException();
  1015.         }
  1016.  
  1017.         [NativeMethod(Function = "CA_RayCastLineNormal")]
  1018.         public virtual int RayCastLineNormal(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float nx, out float ny, out float nz)
  1019.         {
  1020.             throw new NativeNotImplementedException();
  1021.         }
  1022.  
  1023.         [NativeMethod(Function = "CA_ContactTest")]
  1024.         public virtual int ContactTest(int modelId, float x, float y, float z, float rx, float ry, float rz)
  1025.         {
  1026.             throw new NativeNotImplementedException();
  1027.         }
  1028.  
  1029.         [NativeMethod(Function = "CA_EulerToQuat")]
  1030.         public virtual int EulerToQuat(float rx, float ry, float rz, out float x, out float y, out float z, out float w)
  1031.         {
  1032.             throw new NativeNotImplementedException();
  1033.         }
  1034.  
  1035.         [NativeMethod(Function = "CA_QuatToEuler")]
  1036.         public virtual int QuatToEuler(float x, float y, float z, float w, out float rx, out float ry, out float rz)
  1037.         {
  1038.             throw new NativeNotImplementedException();
  1039.         }
  1040.  
  1041.         [NativeMethod(Function = "CA_GetModelBoundingSphere")]
  1042.         public virtual int GetModelBoundingSphere(int modelId, out float offsetX, out float offsetY, out float offsetZ, out float radius)
  1043.         {
  1044.             throw new NativeNotImplementedException();
  1045.         }
  1046.  
  1047.         [NativeMethod(Function = "CA_GetModelBoundingBox")]
  1048.         public virtual int GetModelBoundingBox(int modelId, out float minX, out float minY, out float minZ, out float maxX, out float maxY, out float maxZ)
  1049.         {
  1050.             throw new NativeNotImplementedException();
  1051.         }
  1052.  
  1053.         [NativeMethod(Function = "CA_RayCastLineEx")]
  1054.         public virtual int RayCastLineEx(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float rx, out float ry, out float rz, out float rw, out float cx, out float cy, out float cz)
  1055.         {
  1056.             throw new NativeNotImplementedException();
  1057.         }
  1058.  
  1059.         [NativeMethod(Function = "CA_RayCastLineAngleEx")]
  1060.         public virtual int RayCastLineAngleEx(float startX, float startY, float startZ, float endX, float endY, float endZ, out float x, out float y, out float z, out float rx, out float ry, out float rz, out float ocx, out float ocy, out float ocz, out float orx, out float ory, out float orz)
  1061.         {
  1062.             throw new NativeNotImplementedException();
  1063.         }
  1064.  
  1065.         [NativeMethod(Function = "CA_CreateObject")]
  1066.         public virtual int CreateObject(int modelId, float x, float y, float z, float rx, float ry, float rz, bool index = false)
  1067.         {
  1068.             throw new NativeNotImplementedException();
  1069.         }
  1070.  
  1071.         [NativeMethod(Function = "CA_DestroyObject")]
  1072.         public virtual int DestroyObject(int collisionId)
  1073.         {
  1074.             throw new NativeNotImplementedException();
  1075.         }
  1076.  
  1077.         [NativeMethod(Function = "CA_SetObjectPos")]
  1078.         public virtual int SetObjectPos(int collisionId, float x, float y, float z)
  1079.         {
  1080.             throw new NativeNotImplementedException();
  1081.         }
  1082.  
  1083.         [NativeMethod(Function = "CA_SetObjectRot")]
  1084.         public virtual int SetObjectRot(int collisionId, float rx, float ry, float rz)
  1085.         {
  1086.             throw new NativeNotImplementedException();
  1087.         }
  1088.  
  1089.         [NativeMethod(Function = "CA_SetObjectExtraID")]
  1090.         public virtual int SetObjectExtraID(int collisionId, int data, int value)
  1091.         {
  1092.             throw new NativeNotImplementedException();
  1093.         }
  1094.  
  1095.         [NativeMethod(Function = "CA_GetObjectExtraID")]
  1096.         public virtual int GetObjectExtraID(int collisionId, int data)
  1097.         {
  1098.             throw new NativeNotImplementedException();
  1099.         }
  1100.     }
  1101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement