Jump to content
bi_mg

simpler way to orientation vector of objects in 3d space?

Recommended Posts

Hi Guys,

 

i'm searching for a simpler way to rotate objects in 3d Space (yaw, roll, pitch). I never try the tranformation and rotation matrix to solve my problem.

 

My Work:

I started to work on worldToModel that takes an "Object Model Box 3D Space (named _ModelOrign) as a Parameter and puts "3D World Coordinades" (named _position) of another Object in this model space.

private _modelOrign = _this select 0;
private _objectOrign = _this select 1;

private _position = _modelOrign worldToModel getPosWorld _objectOrign;

So I can easily take the saved _position and apply to a targeting Object (named _modelTarget) that is differend rotating in 3D as the Object _modelOrign. Then I just execute the finction modelToWorld and voila the _position is rotating to the rotated _modelTarget in Model Box 3D Space as well. Nice and easy.

privat _objectTarget = _this select 0;
privat _modelTarget = _this select 1;
privat _position = _this select 2;

_objectTarget setPosWorld ( _modelTarget modelToWorld _position )

Orientation:
to get the orientation of _objectOrign in 3D Space, i used vectorDir and vectorUp of _ modelOrign to get this orientation and apply it to this _objectOrign with the oriantation itsself.

 

Wiki Source: Euler_angles

Euler2a.gif800px-Euler_angles_(Euler's_paper_E825).png

 

 

Problem:

I've have no idea to combine these two orientations vectors of _modelOrign and _objectOrign to get this problem of the orientation solved. I never used the transformation and rotation matrix.

 

  • There sould be an easier way to do this. BIS serve an function BIS_fnc_setPitchBank in the past but I've heard that it is not precisely :/. I've never try it out.
  • I'm sceptic about the documentation of vectorModelToWorld explains that it only use vectorDir and not vectorUp. I never try it.
  • im very sure that there is a modern simpler way to solve this problem by a bunch of Arma 3+ vector functions for example addTorque but I do not understand the explanation at all, i'm not english.

 

thank you

Edited by bi_mg
add Images, add tags, change code function

Share this post


Link to post
Share on other sites

could you describe more detailed what you are trying to archive, please? You described what you tried already but I didn't understand what your goal is...

 

if this is the only thing:

21 hours ago, bi_mg said:

i'm searching for a simpler way to rotate objects in 3d Space (yaw, roll, pitch).

then it's easy to do with this article:

https://community.bistudio.com/wiki/setVectorDirAndUp

the function fnc_SetPitchBankYaw described in ffur2007slx2_5's comment shows you how to get vector dir and up by rotation angles...

 

Share this post


Link to post
Share on other sites

Hi @sarogahtyp,

 

firstofall thank u for your rapid response. I apologize for my problem explanation.

 

I do know setVectorDirAndUp. I just work with it an vectorDir and vectorUp - it a pity that getVectorDirAndUp dosn't exists by now.

I explane my problem with angles.

Exaple with angular degree:
I grab the rotation of anchor Object (90° yaw, 180° roll, 135° pitch). In Model space of the Object is the rotation (0° yaw, 0° roll, 0° pitch) we know. The rotation of around Object is (270° yaw, 90° roll, 0° pitch) for example. When I grab the around object relaing to the anchor object i must know the routation of the anchor object to get the right rotation of the around object. for exampl

// in world space
anchor Object = (90° yaw, 180° roll, 135° pitch);
around Object = (270° yaw, 90° roll, 0° pitch);

// transformet in model space of anchor object
anchor Object = (0° yaw, 0° roll, 0° pitch);
around Object = (270° -90° = 180° yaw, 90° -180° = 270° roll, 0° -135° = 225° pitch);

it's easy when the pitch and roll is 0° angular degree of both objects. Then I can easily take the function:

// orign
_anchorObjectDir = getDir _anchorObject;
_aroundObjectDir = getDir _aroundObject;

// transform
_anchorModelDir = 0;
_aroundModelDir = _aroundObjectDir -_anchorObjectDir;

// apply
_anchorObject setDir _anchorModelDir;
_aroundObject setDir _aroundModelDir;

Nice and easy for yaw rotation. But we have two other angles as I said. I really hope, my Problem with vector rotation, can be understand better.

Edited by bi_mg
text add

Share this post


Link to post
Share on other sites

I read it 12 times I guess, but idk what you want to do. could you explain it more practically like "I want to get a lift rotate around a ball" or something like that?

 

also I don't understand:

28 minutes ago, bi_mg said:

 I just work with it an vectorDir and vectorUp - it a pity that getVectorDirAndUp dosn't exists by now.

its the same meaning ... [vectorDir, vectorUp] is the same as getVectorDirAndUp would deliver...

Share this post


Link to post
Share on other sites

Hi @johnnyboy,

 

I mentioned BIS_fnc_setPitchBank in the beginning of my thread (I've fottogen to mention the BIS_fnc_setObjectRotation, sry). You definitely got what I am searching for and the function you mentioned is the right goal - but old. Then function BIS_fnc_setPitchBank itself was written with the outcome of Arma 2 1.0 if I informed correctly. BIS_fnc_setPitchBank must be preprocessed, compiled and called (Arma 3 had already integrated in the core). these to function worked with euler angles more or less. I'm quiet sure that there is a better modern way for function in form of commands like setDir, getDir. You know what I mean :).

Share this post


Link to post
Share on other sites

@sarogahtyp,
I apologize twice mein explanation. But I realy can't serve what I explaned before. Sry :(.

Share this post


Link to post
Share on other sites
12 minutes ago, bi_mg said:

Hi @johnnyboy,

 

I mentioned BIS_fnc_setPitchBank in the beginning of my thread (I've fottogen to mention the BIS_fnc_setObjectRotation, sry). You definitely got what I am searching for and the function you mentioned is the right goal - but old. Then function BIS_fnc_setPitchBank itself was written with the outcome of Arma 2 1.0 if I informed correctly. BIS_fnc_setPitchBank must be preprocessed, compiled and called (Arma 3 had already integrated in the core). these to function worked with euler angles more or less. I'm quiet sure that there is a better modern way for function in form of commands like setDir, getDir. You know what I mean :).

Oh, I missed that.  Thanks for mentioning BIS_fnc_setObjectRotation, as I did not know about that command.  That would have made my life much easier in the many times I've struggled with setVectorDirAndUP!   😀

  • Like 2

Share this post


Link to post
Share on other sites

Hey guys @sarogahtyp, @johnnyboy,


I think I've found what I was searching for: vectorWorldToModel and vectorModelToWorld. The command converts a world vector in format [yaw,pitch,roll] of an object in model space of an other object. rtealy cool.

all in all thanks guys for questioning that brings me forward to researching in an other way 🙂

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×