Skip to content

Commit

Permalink
Merge pull request #18 from bryant1410/source2
Browse files Browse the repository at this point in the history
Fix broken headings in Markdown files
  • Loading branch information
bmddota authored Apr 17, 2017
2 parents 74daf3f + 2746338 commit 873bcb9
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 130 deletions.
52 changes: 26 additions & 26 deletions CollidersReadme.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#**BMD's Lua Unit Colliders Library**
# **BMD's Lua Unit Colliders Library**
--------------------------------
See [PhysicsReadme.md](https://github.com/bmddota/barebones/blob/source2/PhysicsReadme.md) for documentation and examples on using Physics/Motion controls.

####**How to install:**
#### **How to install:**
- Drop physics.lua in with your vscripts
- Add require( 'physics' ) somewhere in your lua instantiation path

####**How to use:**
#### **How to use:**
- The colliders system can operate on regular units and Physics-units (though can only operate on Physics-units in some noted cases)
- Colliders are constructed out of collider tables, of which several profiles are provided with this library (and more can be created)
- Colliders are one of 3 primary types, COLLIDER_SPHERE, COLLIDER_BOX, or COLLIDER_AABOX
Expand All @@ -19,39 +19,39 @@ See [PhysicsReadme.md](https://github.com/bmddota/barebones/blob/source2/Physics

**Colliders Library Functions**
=============================
####**Physics:AddCollider([name,] collider)**
#### **Physics:AddCollider([name,] collider)**
This function is used for creating a collider without a profile without being tied to any particular unit. The "name" parameter is optional, but must be unique if given. Collider follows the standard collider format as given in the Collider Format section. Returns the registered collider for additional modification/reference.

####**Physics:ColliderFromProfile(profileName[, collider])**
#### **Physics:ColliderFromProfile(profileName[, collider])**
This function is used to create a new collider from the given collider profile name. The profile name must match a registered profile. Returns a copy of the collider profile modified with the properties passed in for the 'collider' table if given.

####**Physics:CreateColliderProfile(profileName, profile)**
#### **Physics:CreateColliderProfile(profileName, profile)**
This function is used to create and register a new collider profile for the given profile name. This registered collider profile can then be used to create new colliders using the profile collider table as a base.

####**Physics:RemoveCollider(name)**
#### **Physics:RemoveCollider(name)**
This function removes a collider by name from the Physics API so that it is no longer processed.


**PhysicsUnit Functions**
=============================
A unit which has been converted to a Physics Unit can have a collider attached to it and managed using the following functions:

####**AddCollider([name,] collider)**
#### **AddCollider([name,] collider)**
This function can be called to add a collider (in the correct Collider Format) to the unit. An optional name can be given, or a unique name will be used. The resulting collider will be returned for further adjustment/management.

####**AddColliderFromProfile([name,] profile, [collider])**
#### **AddColliderFromProfile([name,] profile, [collider])**
This function can be called to add a collider from a registered collider profile to this unit. The profile must be provided, as can an optional name or collider properties table. The resulting collider will be returned for further adjustment/management.

####**GetColliders()**
#### **GetColliders()**
Returns a table of all colliders attached to this unit in {name=colliderTable} format.

####**GetMass()**
#### **GetMass()**
Returns the mass of this unit for use in "momentum" collider calculations. The default mass is set to 100.

####**RemoveCollider(name)**
#### **RemoveCollider(name)**
This function can be called to remove a collider by name from this unit. The collider will also be removed from the Physics API.

####**SetMass(mass)**
#### **SetMass(mass)**
Sets the mass of this unit for use in "momentum" collider calculations.


Expand All @@ -60,7 +60,7 @@ A unit which has been converted to a Physics Unit can have a collider attached t
=============================
Colliders are effectively a formatted lua table which is registered with the Physics API for processing and action. All collider tables have the following properties and functions, though individual colliders can have additional properties/functions in order to support their actions:

###**COLLIDER_SPHERE Type**
### **COLLIDER_SPHERE Type**
| Property | Description |
| :------------ | :-----|
| draw | Whether to DebugDraw the collider for visual confirmation. Additionally, a table can be provided with color and alpha properties. |
Expand All @@ -81,7 +81,7 @@ Colliders are effectively a formatted lua table which is registered with the Phy
| test | colliderTable, colliderUnit, collidedUnit | Called when a unit is found within the collider range to test for matching the collider criteria. This function should return true if the collider should interact with the colliding unit, and false if not. |


###**COLLIDER_BOX/COLLIDER_AABOX Type**
### **COLLIDER_BOX/COLLIDER_AABOX Type**

| Property | Description |
| :------------ | :-----|
Expand All @@ -106,9 +106,9 @@ Colliders are effectively a formatted lua table which is registered with the Phy

**Built-in Collider Profiles**
=============================
##**COLLIDER_SPHERE**
## **COLLIDER_SPHERE**

###**blocker**
### **blocker**
A blocker collider blocks out either the colliding unit or the collider-attached unit whenever a successful collision is found. Can affect non-Physics units.

| Property | Description |
Expand All @@ -118,7 +118,7 @@ A blocker collider blocks out either the colliding unit or the collider-attached
| moveSelf | If set to true, this collider will move the attached unit instead of the colliding unit. Defaults to false.|


###**delete**
### **delete**
A delete collider deletes the colliding unit or the collider-attached unit whenever a successful collision is found. Can affect non-Physics units.

| Property | Description |
Expand All @@ -127,7 +127,7 @@ A delete collider deletes the colliding unit or the collider-attached unit whene
| removeCollider | When this collider successfully collides with a unit, immediately remove it so as to prevent further collisions. Defaults to true. |


###**gravity**
### **gravity**
A gravity collider applies a force to any colliding unit attracting it towards the collider-attached unit with a given force and function.

| Property | Description |
Expand All @@ -138,7 +138,7 @@ A gravity collider applies a force to any colliding unit attracting it towards t
| minRadius | The radius to use for when a colliding unit is too close to the attached unit and should receive 0 gravitational force. An "eye-of-the-storm" radius. Default is 0.|


###**repel**
### **repel**
A repel collider applies a force to any colliding unit repelling it away from the collider-attached unit with a given force and function.

| Property | Description |
Expand All @@ -149,7 +149,7 @@ A repel collider applies a force to any colliding unit repelling it away from th
| minRadius | The radius to use for when a colliding unit is too close to the attached unit and should receive 0 repulsion force. An "eye-of-the-storm" radius. Default is 0.|


###**reflect**
### **reflect**
A reflect collider applies a reflection force using the incident vector of collision with the collider sphere to redirect the velocity of the colliding unit. Additionally can act as a blocker.

| Property | Description |
Expand All @@ -162,7 +162,7 @@ A reflect collider applies a reflection force using the incident vector of colli
| multiplier | The scalar multiplier to apply to the incident vector velocity to create the reflecting force. Defaults to 1.0|


###**momentum**
### **momentum**
A momentum collider applies a force to the colliding unit and collider-attached unit in accordance with their mass as set on their Physics Unit settings. The elasticity coefficient of the collision can be set. Additionally can act as a blocker.

| Property | Description |
Expand All @@ -174,7 +174,7 @@ A momentum collider applies a force to the colliding unit and collider-attached
| findClearSpace | If blocking, whether to use FindClearSpaceForUnit to block the colliding unit out. Defaults to false. |
| moveSelf | If blocking and set to true, this collider will move the attached unit instead of the colliding unit. Defaults to false.|

###**momentumFull**
### **momentumFull**
A momentumFull collider applies a force to the colliding unit and collider-attached unit in accordance with their mass as set on their Physics Unit settings. MomentumFull differs from a standard momentum collider by ensuring that full force is always transferred regardless of the angle. The elasticity coefficient of the collision can be set. Additionally can act as a blocker.

| Property | Description |
Expand All @@ -188,9 +188,9 @@ A momentumFull collider applies a force to the colliding unit and collider-attac


-----------------------------------
##**COLLIDER_AABOX / COLLIDER_BOX**
## **COLLIDER_AABOX / COLLIDER_BOX**

###**aaboxblocker** / **boxblocker**
### **aaboxblocker** / **boxblocker**
A boxblocker collider blocks out the colliding unit whenever a successful collision is found. Can affect non-Physics units if 'slide' property is set to false.

| Property | Description |
Expand All @@ -200,7 +200,7 @@ A boxblocker collider blocks out the colliding unit whenever a successful collis
| slide | Whether the colliding Physics Unit should slide along the edge of the box with which it collides. Defaults to true.|


###**aaboxreflect** / **boxreflect**
### **aaboxreflect** / **boxreflect**
A boxreflect collider blocks out the colliding unit whenever a successful collision is found.

| Property | Description |
Expand Down
Loading

0 comments on commit 873bcb9

Please sign in to comment.