33 lines
845 B
Markdown
33 lines
845 B
Markdown
# DeicideLookS.js — main() (satır 14)
|
||
|
||
[← DeicideLookS.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function main(c)
|
||
{
|
||
var target = c.getSubject();
|
||
var source = c.getServer().getPlayer("Xyrveth");
|
||
|
||
var sourcePos = source.getPosition();
|
||
var targetPos = target.getPosition();
|
||
|
||
var sourceEyes = {
|
||
x: sourcePos.x,
|
||
y: sourcePos.y + source.getEyeHeight(),
|
||
z: sourcePos.z
|
||
};
|
||
|
||
var targetEyes = {
|
||
x: targetPos.x,
|
||
y: targetPos.y + target.getEyeHeight(),
|
||
z: targetPos.z
|
||
};
|
||
|
||
var look = calculateLookRotation(targetEyes, sourceEyes);
|
||
|
||
target.setRotations(look.pitch, look.yaw, look.yaw);
|
||
target.lockRotation(look.yaw, look.pitch, look.yaw);
|
||
target.lockPosition(targetPos.x, targetPos.y, targetPos.z);
|
||
}
|
||
```
|