Page MenuHomeFeedback Tracker

[Feature Request] New command to return all object vectors
New, NormalPublic

Description

Currently SQF only returns 2 object vectors: vectorDir and vectorUp. The problem is that in Arma objects can be skewed as well, so to fully represent the object orientation you need another vector: vectorRight.

Since that name is kinda awful, I suggest making a command that returns them all in one:

getObjectRotation

which returns a 3x3 matrix: [vectorX, vectorY, vectorZ]

Sample script to verify the command (run this on Altis):

_o = [18003.4,15311.4,34.8394] nearestObject "559030";

// wrong orientation:
_y = vectorDir _o;
_z = vectorUp _o;
_x = _y vectorCrossProduct _z; // this vector however is wrong, due to object being skewed 

_wrongRotation = [_x, _y, _z]; // [[-0.771352,0.636146,0.00170559],[-0.636251,-0.771484,0.00153818],[0.00221079,0,0.99983]]

_correctRotation = getObjectRotation _o; // [[-0.7714816332,0.6362524629,0.1010795683],[-0.636251,-0.771484,0.00153818],[0.00221079,0,0.99983]]

If possible, having a setter version that allows you to place simple and super simple objects with the added skew would be appreciated:

obj setObjectRotation rotationMatrix

Details

Severity
Feature
Resolution
Open
Reproducibility
N/A
Operating System
Windows 10 x64
Category
Scripting

Event Timeline

Leopard20 created this task.Mar 3 2023, 8:20 PM
Leopard20 updated the task description. (Show Details)Mar 3 2023, 8:32 PM
Leopard20 updated the task description. (Show Details)Mar 3 2023, 8:42 PM

if Possible, maybe also add a 4x4 matrix, so that we can use Euler Angles more naturally. 4X4 matices would also allow for Translation, Rotation, Scale, Projection, or a big favorite of mine, Look-At Matrix. An addition for 4x4 is also having a model-view matrix which positions and orients the object in the world space.

Ah good one, always wanted to add vectorSide

Leopard20 updated the task description. (Show Details)Mar 4 2023, 12:22 PM

if Possible, maybe also add a 4x4 matrix, so that we can use Euler Angles more naturally. 4X4 matices would also allow for Translation, Rotation, Scale, Projection, or a big favorite of mine, Look-At Matrix. An addition for 4x4 is also having a model-view matrix which positions and orients the object in the world space.

Euler angles are embedded in the 3x3 rotation matrix and you don't need a 4x4 matrix for that. The last column is just for translation.

Also the 4x4 lookAt matrix can be created by yourself. And it's not related to object model to world matrix anyway.

SaMatra added a subscriber: SaMatra.Mar 5 2023, 6:27 AM

Revision: 150340 vectorSide, vectorSideVisual. I will look at matrix commands later

dedmen set Ref Ticket to AIII-55580.Mar 13 2023, 10:26 AM