setVelocityTransformation: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
(inserted more details from VBS2 version. TODO: define local or global argument/effect)
Line 7: Line 7:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Interpolate and sets vectors. For additional info see [http://resources.bisimulations.com/wiki/setVelocityTransformation this resource].|= Description
| Places an object at an interpolated position between two other objects and sets its vectors in proportion to the relative position.<br>
<br>
The final position/vector is determined by the "interval" specified in the command.<br>
This assumes an imaginary path between the two reference objects, where<br>
at the ''beginning'' of the path (interval: 0) the position and vector are identical to the ''first'' reference object,<br>
at the ''end'' of the path (interval: 1) they're identical to the ''second'' reference object,<br>
and at 0.5 they are halfway in-between.<br>
<br>
See [http://resources.bisimulations.com/wiki/setVelocityTransformation setVelocityTransformation (VBS2)] for more details. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| object '''setVelocityTransformation''' [position1, position2, velocity1, velocity2, direction1, direction2, up1, up2, time] |= Syntax
| object '''setVelocityTransformation''' [position1, position2, velocity1, velocity2, direction1, direction2, upVector1, upVector2, interval] |= Syntax


|p1= object: [[Object]] |=  
|p1= object: [[Object]] - Object to be positioned |=  
|p2= position1: [[PositionASL]]
|p2= position1: [[PositionASL]] - ASL position of first reference object
|p3= position2: [[PositionASL]]
|p3= position2: [[PositionASL]] - ASL position of second reference object
|p4= velocity1: [[Vector3D]]
|p4= velocity1: [[Vector3D]] - [[velocity|Velocity]] of first reference object
|p5= velocity2: [[Vector3D]]
|p5= velocity2: [[Vector3D]] - [[velocity|Velocity]] of second reference object
|p6= direction1: [[Vector3D]]
|p6= direction1: [[Vector3D]] - [[vectorDir|Direction vector]] of first reference object
|p7= direction2: [[Vector3D]]
|p7= direction2: [[Vector3D]] - [[vectorDir|Direction vector]] of second reference object
|p8= up1: [[Vector3D]]
|p8= upVector1: [[Vector3D]] - [[vectorUp|Upright vector]] of first reference object
|p9= up2: [[Vector3D]]
|p9= upVector2: [[Vector3D]] - [[vectorUp|Upright vector]] of second reference object
|p10= interval: [[Number]] - Relative period between the two references where the manipulated object will be placed. (0-1)
|p10= interval: [[Number]] - Relative position between the two reference objects where the manipulated object will be placed at. (Range 0..1)
| [[Nothing]] |= Return value
| [[Nothing]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________



Revision as of 01:11, 15 November 2017

Hover & click on the images for description

Description

Description:
Places an object at an interpolated position between two other objects and sets its vectors in proportion to the relative position.

The final position/vector is determined by the "interval" specified in the command.
This assumes an imaginary path between the two reference objects, where
at the beginning of the path (interval: 0) the position and vector are identical to the first reference object,
at the end of the path (interval: 1) they're identical to the second reference object,
and at 0.5 they are halfway in-between.

See setVelocityTransformation (VBS2) for more details.
Groups:
Uncategorised

Syntax

Syntax:
object setVelocityTransformation [position1, position2, velocity1, velocity2, direction1, direction2, upVector1, upVector2, interval]
Parameters:
object: Object - Object to be positioned
position1: PositionASL - ASL position of first reference object
position2: PositionASL - ASL position of second reference object
velocity1: Vector3D - Velocity of first reference object
velocity2: Vector3D - Velocity of second reference object
direction1: Vector3D - Direction vector of first reference object
direction2: Vector3D - Direction vector of second reference object
upVector1: Vector3D - Upright vector of first reference object
upVector2: Vector3D - Upright vector of second reference object
interval: Number - Relative position between the two reference objects where the manipulated object will be placed at. (Range 0..1)
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 ];
Example 2:
Bob on imaginary stairway to heaven:bob = createAgent ["C_man_1", player getRelPos [5, 0], [], 0, "CAN_COLLIDE"]; bob switchMove "ladderciviluploop"; pos1 = getPosASL bob; pos2 = pos1 vectorAdd [0,0,0.75]; bob addEventHandler ["AnimDone", { pos1 = pos2; pos2 = pos2 vectorAdd [0,0,0.75] }]; onEachFrame { if (!alive bob) then { onEachFrame {}; bob switchMove ""; bob removeAllEventHandlers "AnimDone"; }; bob setVelocityTransformation [ pos1, pos2, [0,0,0], [0,0,0], [0,1,0], [0,1,0], [0,0,1], [0,0,1], moveTime bob ]; };

Additional Information

See also:
velocitysetVelocityvelocityModelSpacesetVelocityModelSpacesetVelocityTransformationspeedmoveTime

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 _stepOld; _dataNext = _capturedData select _stepNext; _stepOld = _stepOld + 1; _stepNext = if (_stepNext >= (count _capturedData)) then [{_stepOld},{_stepNext + 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