setVelocityTransformation: Difference between revisions
Jump to navigation
Jump to search
(example) |
(note added) |
||
Line 47: | Line 47: | ||
<dl class="command_description"> | <dl class="command_description"> | ||
<!-- Note Section BEGIN --> | <!-- Note Section BEGIN --> | ||
<dd class="notedate">Posted on Aug 4, 2014 – 12:35 | |||
<dt class="note">[[User:ffur2007slx2_5|ffur2007slx2_5]]<dd class="note"> | |||
(A3 1.24) Generally speaking [[setVelocityTransformation]] is more likely a combination of [[setPosASL]], [[setVectorDirAndUp]] (or [[BIS_fnc_setPitchBank]]) and time multiplier. It can be used as a position tracker with all necessary information collected, copied and then released within one function. Here’s a simple reproduction on how [[setVelocityTransformation]] works in game: | |||
<code> | |||
[[private]] ["_dataOld","_dataNext","_capturedData","_obj","_fps","_startTrackingTime","_stepOld","_stepNext","_tracker","_tempTime"]; | |||
_stepOld = 0; | |||
_tempTime = 0; | |||
_stepNext = 1; | |||
[[while]] {[[true]]} [[do]] { | |||
_capturedData = _capturedData + [[ [[getPosASL]] _obj,[[velocity]] _obj,[[vectorDir]] _obj,[[vectorUp]] _obj]]; | |||
[[sleep]] _fps; | |||
_tempTime = _tempTime + _fps; | |||
[[if]] (_tempTime >= _startTrackingTime) [[then]] { | |||
_dataOld = _capturedData [[select]] _step0; | |||
_dataNext = _capturedData [[select]] _step1; | |||
_stepOld = _stepOld + 1; | |||
_stepNext = [[if]] (_stepNext >= ([[count]] _capturedData)) [[then]] [{_step0},{_step1 + 1}]; | |||
_tracker [[setVelocityTransformation]] | |||
[_dataOld [[select]] 0,_dataNext [[select]] 0,_dataOld [[select]] 1,_dataNext [[select]] 1, | |||
_dataOld [[select]] 2,_dataNext [[select]] 2,_dataOld [[select]] 3,_dataNext [[select]] 3,1]; | |||
}; | |||
};</code> | |||
Tracker starts coping the route and stance from the object when time start counting. TimeDiff determines the distance multiply between the current position and the next position. | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
</dl> | </dl> |
Revision as of 05:47, 4 August 2014
Description
- Description:
- Interpolate and sets vectors. For additional info see this resource.
- Groups:
- Uncategorised
Syntax
- Syntax:
- objectName setVelocityTransformation [position1, position2, velocity1, velocity2, direction1, direction2, up1, up2, time]
- Parameters:
- objectName: Object
- position1: Number
- position2: Number
- velocity1: Number
- velocity2: Number
- direction1: Number
- direction2: Number
- up1: Number
- up2: Number
- time: Number
- Return Value:
- Nothing
Examples
- Example 1:
_tracker setVelocityTransformation [ getPosASL _currentPos, getPosASL _nextPos, velocity _currentVelocity, velocity _nextVelocity, vectorDir _currentVectorDir, vectorDir _nextVectorDir, vectorUp _currentVectorUp, vectorUp _nextVectorUp, _timeDiff ];
Additional Information
- See also:
- velocity, velocityModelSpace, setVelocity
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
- Posted on Aug 4, 2014 – 12:35
- ffur2007slx2_5
-
(A3 1.24) Generally speaking setVelocityTransformation is more likely a combination of setPosASL, setVectorDirAndUp (or BIS_fnc_setPitchBank) and time multiplier. It can be used as a position tracker with all necessary information collected, copied and then released within one function. Here’s a simple reproduction on how setVelocityTransformation works in game:
private ["_dataOld","_dataNext","_capturedData","_obj","_fps","_startTrackingTime","_stepOld","_stepNext","_tracker","_tempTime"]; _stepOld = 0; _tempTime = 0; _stepNext = 1; while {true} do { _capturedData = _capturedData + [[ getPosASL _obj,velocity _obj,vectorDir _obj,vectorUp _obj]]; sleep _fps; _tempTime = _tempTime + _fps; if (_tempTime >= _startTrackingTime) then { _dataOld = _capturedData select _step0; _dataNext = _capturedData select _step1; _stepOld = _stepOld + 1; _stepNext = if (_stepNext >= (count _capturedData)) then [{_step0},{_step1 + 1}]; _tracker setVelocityTransformation [_dataOld select 0,_dataNext select 0,_dataOld select 1,_dataNext select 1, _dataOld select 2,_dataNext select 2,_dataOld select 3,_dataNext select 3,1]; }; };
Tracker starts coping the route and stance from the object when time start counting. TimeDiff determines the distance multiply between the current position and the next position.
Bottom Section
Categories:
- Scripting Commands
- Introduced with Arma 2: Operation Arrowhead version 1.51
- Arma 2: Operation Arrowhead: New Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Scripting Commands Take On Helicopters
- ArmA 2 OA: New Scripting Commands List