Cleaned up dragging-framework

This commit is contained in:
jonpas 2015-08-25 02:33:34 +02:00
parent 8553396b1d
commit 126ae37a9a

View File

@ -1,7 +1,7 @@
---
layout: wiki
title: Carry and Drag framework
description:
title: Dragging/Carrying Framework
description: Explains how to set-up dragging and carrying of objects with the ACE3 dragging and carrying system.
group: framework
order: 5
parent: wiki
@ -12,84 +12,83 @@ parent: wiki
```c++
class CfgVehicles {
class MyVehicle {
// Dragging
ace_dragging_canDrag = 1; // Can be dragged (0-no, 1-yes)
ace_dragging_dragPosition[] = {0, 1.2, 0}; // Offset of the model from the body while dragging (same as attachTo)
ace_dragging_dragDirection = 0; // Model direction while dragging (same as setDir after attachTo)
ace_dragging_canDrag = 1; // can this object be dragged?; 1 yes, 0 no (0 default)
ace_dragging_dragPosition[] = {0,1.2,0} // Offset of the model from the body while dragging, comparable to the offset in attachTo (It's the same actually)
ace_dragging_dragDirection = 0; // how much degrees is the model rotatated after dragging it (a global setDir after attachTo)
ace_dragging_canCarry = 1; // can this object be carried?; 1 yes, 0 no (0 default)
ace_dragging_carryPosition[] = {0,1.2,0}; // Same as drag, but for carrying objects
ace_dragging_carryDirection = 0; // Same as drag, but for carrying objects
// Carrying
ace_dragging_canCarry = 1; // Can be carried (0-no, 1-yes)
ace_dragging_carryPosition[] = {0, 1.2, 0}; // Offset of the model from the body while dragging (same as attachTo)
ace_dragging_carryDirection = 0; // Model direction while dragging (same as setDir after attachTo)
};
};
```
## 2. Functions
**NOTE THAT THE FOLLOWING FUNCTIONS ARE NOT PUBLIC AND THUS MAY CHANGE IN THE FUTURE.**</br>
<div class="panel callout">
<h5>Note:</h5>
<p>The following functions are NOT public and are likely to change in the future!</p>
</div>
Also note that if the item is too heavy you won't be able to carry / drag it, the mass is also affected by what's inside it.</br>
To bypass this empty the object and / or use setMass.</br>
You will **not** be able to carry / drag objects that are too heavy, the mass is also affected by what is inside the object. To bypass this empty the object and/or use `setMass`.
### 2.1 Enabling / disabling dragging
`ace_dragging_fnc_setDraggable.` </br>
Enable the object to be dragged. </br>
`ace_dragging_fnc_setDraggable`
| Arguments | |
--------------| -------- |
0 | Any object (Object)
1: | true to enable dragging, false to disable (Bool)
2:| Position offset for attachTo command (Array, optional; default: [0,0,0])
3: | Direction in degree to rotate the object after attachTo (Number, optional; default: 0)
Return value: NONE </br>
| Arguments | Type | Optional (default value) |
- | --------- | ---- | ------------------------ |
0 | Any object | Object | Required
1 | Enable dragging, true to enable, false to disable | Boolean | Required
2 | Position to offset the object from player | Array | Optional (default: `[0, 0, 0]`)
3 | Direction in degree to rotate the object | Number | Optional (default: `0`)
**R** | None | None | Return value
#### 2.1.1 example 1:
```
[foo,true,[0,2,0],45] call ace_dragging_fnc_setDraggable
```
| Arguments | |
--------------| -------- |
0:| foo (my object)
1:| true (dragging is enabled)
2:| `[0,2,0]` (0 meters sideways, 2 meters forward, 0 meters upwards)
3:| 45 (the object is rotated by 45°)
#### 2.1.1 Example 1
#### 2.1.2 example 2
```
[bar,false,[3,-2,2],20] call ace_dragging_fnc_setDraggable
```
`[foo, true, [0, 2, 0], 45] call ace_dragging_fnc_setDraggable;`
| Arguments | Explanation |
- | --------- | ----------- |
0 | `foo` | My object
1 | `true` | Dragging is enabled
2 | `[0,2,0]` | 0 meters sideways, 2 meters forward, 0 meters upwards
3 | `45` | Rotated by 45°
#### 2.1.2 Example 2
`[bar, false, [3, -2, 2], 20] call ace_dragging_fnc_setDraggable;`
| Arguments | Explanation |
- | --------- | ----------- |
0 | `bar` | My object
1 | `false` | Dragging is disabled
2 | `[3, -2, 2]` | 3 meters sideways, 2 meters backwards, 2 meters upwards
3 | `20` | Rotated by 20°
| Arguments | |
--------------| -------- |
0:| bar (object)
1:| false (dragging is disabled)
2:| 3 meters sideways, -2 meters backwards, 2 meters upwards
3:| the object is rotated by 20°
### 2.2 Enabling / disabling carrying
`ace_dragging_fnc_setCarryable.` </br>
Enable the object to be carried. </br>
| Arguments | |
--------------| -------- |
0 | Any object (Object)
1:| true to enable carrying, false to disable (Bool)
2:| Position offset for attachTo command (Array, optional; default: [0,1,1])
3:| Direction in degree to rotate the object after attachTo (Number, optional; default: 0)
Return value: NONE </br>
`ace_dragging_fnc_setCarryable`
| Arguments | Type | Optional (default value)
- | --------- | ---- | ------------------------ |
0 | Any object | Object | Required
1 | Enable carrying, true to enable, false to disable | Boolean | Required
2 | Position to offset the object from player | Array | Optional (default: `[0, 1, 1]`)
3 | Direction in degree to rotate the object | Number | Optional (default: `0`)
**R** | None | None | Return value
#### 2.1.1 example 1:
```
[foo,true,[0,3,1],10] call ace_dragging_fnc_setCarryable
```
| Arguments | |
--------------| -------- |
0:| foo (my object)
1:| true (carrying is enabled)
2:| `[0,2,0]` (0 meters sideways, 3 meters forward, 1 meters upwards)
3:| 10 (the object is rotated by 10°)
#### 2.2.1 Example
`[foo, true, [0, 3, 1], 10] call ace_dragging_fnc_setCarryable;`
| Arguments | Explanation |
- | --------- | ----------- |
0 | `foo` | My object
1 | `true`| Carrying is enabled
2 | `[0,2,0]` | 0 meters sideways, 3 meters forward, 1 meter upwards
3 | `10` | Rotated by 10°