I would like to optimize my current scripts before I continuing with a new part.

Therefore I would like to know first how I can improve this line:

```
this.interaction.setEulerAngles(this.climbStart.getEulerAngles().x + 90, this.climbStart.getEulerAngles().y, this.climbStart.getEulerAngles().z);
```

I was thinking about something like this:

```
this.startClimbing(this.climbStart.getPosition(), this.climbStart.getEulerAngles());
```

```
Player.prototype.startClimbing = function(position, rotation) {
this.interaction.setEulerAngles(rotation.x + 90, rotation.y, rotation.z);
};
```

Also I like to know the difference between:

```
this.climbStart.getEulerAngles();
```

and:

```
this.climbStart.getRotation();
```

This is definitely better, since it avoids redundant API calls. It’s not a major performance optimization, but still it’s a good habit.

The first one will return the current world rotation measured in euler angles.

The second one will return the current world rotation measured in quaternions. It’s a different system, more precise and used often in 3D rendering.

Hello @Leonidas!

Thanks for your feedback!

How am I supposed to do this:

```
this.interaction.setEulerAngles(this.climbStart.getRotation().x + 90, this.climbStart.getRotation().y, this.climbStart.getRotation().z);
```

the same as this:

```
this.interaction.setEulerAngles(this.climbStart.getEulerAngles().x + 90, this.climbStart.getEulerAngles().y, this.climbStart.getEulerAngles().z);
```

I have noticed in the past that it cannot be done this way.

I’m not very good at rotations and calculations.

I think you can do it this way:

```
var quat = new pc.Quat().setFromEulerAngles(90, 0, 0);
quat.mul(this.climbStart.getRotation());
this.interaction.setRotation(quat);
```

1 Like