Files

19 lines
451 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# NullObey.js — calculateLookRotation() (satır 1)
[← NullObey.js](index.md) · [← Master](../../wiki.md)
```javascript
function calculateLookRotation(from, to)
{
var dx = to.x - from.x;
var dy = to.y - from.y;
var dz = to.z - from.z;
var flat = Math.sqrt(dx * dx + dz * dz);
return {
yaw: Math.atan2(-dx, dz) * 180 / Math.PI,
pitch: -Math.atan2(dy, flat) * 180 / Math.PI
};
}
```