Hello,

I am trying to implement the Particle-Swarm algorithm using a swarm of ePucks, to do that I need to get the absolute orientation (absolute argument) of a vector.

I don't know how to do that from a Threaded child script, can someone help me?

Many thanks in advance

Davide

## Get the argument (orientation) of a 2D vector

### Re: Get the argument (orientation) of a 2D vector

Hello,

to get the orientation of a scene object's reference frame relative to the world reference frame, simply do:

Above will return the Euler angles of the frame in radians. If you however need the X, Y or Z-vector of the reference frame, then do like:

Cheers

to get the orientation of a scene object's reference frame relative to the world reference frame, simply do:

Code: Select all

`local eulerAngles=simGetObjectOrientation(objectHandle,-1)`

Code: Select all

```
local matrix=simGetObjectMatrix(objectHandle,-1)
local xVector={matrix[1],matrix[5],matrix[9]}
local yVector={matrix[2],matrix[6],matrix[10]}
local zVector={matrix[3],matrix[7],matrix[11]}
```