mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-13 01:24:28 +02:00
update branch
This commit is contained in:
parent
19c6a672d9
commit
31e57a0dcd
1 changed files with 18 additions and 6 deletions
|
@ -22,12 +22,24 @@ var TABLET_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/Tablet-Model-v1-
|
|||
// * position - position in front of the user
|
||||
// * rotation - rotation of entity so it faces the user.
|
||||
function calcSpawnInfo(hand) {
|
||||
var front = Quat.getFront(MyAvatar.orientation);
|
||||
var finalPosition = Vec3.sum(Vec3.sum(MyAvatar.position, Vec3.multiply(0.6, front)), {x: 0, y: 0.6, z: 0})
|
||||
return {
|
||||
position: finalPosition,
|
||||
rotation: Quat.lookAt(finalPosition, MyAvatar.getHeadPosition(), Y_AXIS)
|
||||
};
|
||||
if (HMD.active && hand) {
|
||||
var handController = getControllerWorldLocation(hand, false);
|
||||
var front = Quat.getFront(handController.orientation);
|
||||
var up = Quat.getUp(handController.orientation);
|
||||
var frontOffset = Vec3.sum(handController.position, Vec3.multiply(0.4, up));
|
||||
var finalOffset = Vec3.sum(frontOffset, Vec3.multiply(-0.3, front));
|
||||
return {
|
||||
position: finalOffset,
|
||||
rotation: Quat.lookAt(finalOffset, HMD.position, Y_AXIS)
|
||||
};
|
||||
} else {
|
||||
var front = Quat.getFront(MyAvatar.orientation);
|
||||
var finalPosition = Vec3.sum(Vec3.sum(MyAvatar.position, Vec3.multiply(0.6, front)), {x: 0, y: 0.6, z: 0})
|
||||
return {
|
||||
position: finalPosition,
|
||||
rotation: Quat.lookAt(finalPosition, MyAvatar.getHeadPosition(), Y_AXIS)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// ctor
|
||||
|
|
Loading…
Reference in a new issue