예제 #1
0
 /**
  *  @brief Returns all {@link TSCollider2D} within a circular area. Returns null if there is none.
  *
  *  @param point Center of the circle in world space.
  *  @param radius Radius of the circle.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static TSCollider2D[] OverlapCircleAll(TSVector2 point, FP radius, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((TSCollider2D[])_OverlapCircle(point, radius, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
예제 #2
0
 public void writeTSVector2(TSVector2 v)
 {
     writeFP(v.x);
     writeFP(v.y);
 }
예제 #3
0
 public static TSRaycastHit2D[] RaycastAll(TSVector2 origin, TSVector2 direction, FP distance)
 {
     return(Physics2DWorldManager.instance.RaycastAll(origin, direction, distance));
 }
예제 #4
0
 private static object _OverlapCircle(TSVector2 point, FP radius, Physics2D.BodySpecialSensor sensorType, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return(OverlapGeneric(new Physics2D.CircleShape(radius, 1), point, sensorType, layerMask));
 }
예제 #5
0
 /**
  *  @brief Returns all {@link TSCollider2D} within a capsule area. Returns null if there is none.
  *
  *  @param point Center of the capsule in world space.
  *  @param size Size of the capsule.
  *  @param direction If it is a vertical or horizontal capsule.
  *  @param angle Rotation angle in degrees of the capsule.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static TSCollider2D[] OverlapCapsuleAll(TSVector2 point, TSVector2 size, TSCapsuleDirection2D direction, FP angle, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((TSCollider2D[])_OverlapCapsule(point, size, direction, angle, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
예제 #6
0
 /**
  *  @brief Cast a circle and returns an array {@link TSRaycastHit2D} with information about all {@link TSCollider2D} found. Returns null if there is none.
  *
  *  @param origin Origin of the circle in world space.
  *  @param radius Radius of the circle.
  *  @param direction Direction {@link TSVector2} of the cast.
  *  @param distance Max distance to reach.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static TSRaycastHit2D[] CircleCastAll(TSVector2 origin, FP radius, TSVector2 direction, FP distance, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((TSRaycastHit2D[])_CircleCast(origin, radius, direction, distance, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
예제 #7
0
 /**
  *  @brief Returns the first {@link TSCollider2D} within a small circular area. Returns null if there is none.
  *
  *  @param point Center of the point in world space.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static TSCollider2D OverlapPoint(TSVector2 point, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((TSCollider2D)_OverlapCircle(point, POINT_RADIUS, Physics2D.BodySpecialSensor.ActiveOnce, layerMask));
 }
예제 #8
0
 /**
  *  @brief Returns the first {@link TSCollider2D} within a box area. Returns null if there is none.
  *
  *  @param point Center of the box in world space.
  *  @param size Size of the box.
  *  @param angle Rotation angle in degrees of the box.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static TSCollider2D OverlapBox(TSVector2 point, TSVector2 size, FP angle, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((TSCollider2D)_OverlapBox(point, size, angle, Physics2D.BodySpecialSensor.ActiveOnce, layerMask));
 }
예제 #9
0
 /**
  * @brief Adds a new TSVector2 value.
  **/
 internal void AddTSVector2(byte key, TSVector2 value)
 {
     this.tsVectorTable2[key] = value;
 }
예제 #10
0
 /**
  *  @brief Returns all {@link TSCollider2D} within a rectangular area. Returns null if there is none.
  *
  *  @param pointA Top-left corner of the rectangle.
  *  @param radius Bottom-right corner of the rectangle.
  *  @param layerMask Unity's layer mask to filter objects.
  **/
 public static TSCollider2D[] OverlapAreaAll(TSVector2 pointA, TSVector2 pointB, int layerMask = UnityEngine.Physics.DefaultRaycastLayers)
 {
     return((TSCollider2D[])_OverlapArea(pointA, pointB, Physics2D.BodySpecialSensor.ActiveAll, layerMask));
 }
예제 #11
0
 /**
  *  @brief Moves the body to a new position.
  **/
 public void MovePosition(TSVector2 position)
 {
     this.position = position;
 }
예제 #12
0
 /**
  *  @brief Simulates the provided tourque in the body.
  *
  *  @param torque A {@link TSVector2} representing the torque to be applied.
  **/
 public void AddTorque(TSVector2 torque)
 {
     tsCollider.Body.TSApplyTorque(torque);
 }
예제 #13
0
        /**
         *  @brief Returns the velocity of the body at some position in world space.
         **/
        public TSVector2 GetPointVelocity(TSVector2 worldPoint)
        {
            TSVector directionPoint = (position - tsCollider.Body.TSPosition).ToTSVector();

            return(TSVector.Cross(new TSVector(0, 0, tsCollider.Body.TSAngularVelocity), directionPoint).ToTSVector2() + tsCollider.Body.TSLinearVelocity);
        }
예제 #14
0
 /**
  *  @brief Applies the provided force in the body.
  *
  *  @param force A {@link TSVector2} representing the force to be applied.
  *  @param position Indicates the location where the force should hit.
  **/
 public void AddForceAtPosition(TSVector2 force, TSVector2 position)
 {
     AddForceAtPosition(force, position, ForceMode.Impulse);
 }
예제 #15
0
 /**
  *  @brief Applies the provided force in the body.
  *
  *  @param force A {@link TSVector2} representing the force to be applied.
  **/
 public void AddForce(TSVector2 force)
 {
     AddForce(force, ForceMode.Force);
 }