本文整理汇总了TypeScript中THREE.Vector3.multiplyScalar方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Vector3.multiplyScalar方法的具体用法?TypeScript Vector3.multiplyScalar怎么用?TypeScript Vector3.multiplyScalar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THREE.Vector3
的用法示例。
在下文中一共展示了Vector3.multiplyScalar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _applyRotation
private _applyRotation(camera: Camera): void {
if (camera == null) {
return;
}
let q: THREE.Quaternion = new THREE.Quaternion().setFromUnitVectors(camera.up, new THREE.Vector3( 0, 0, 1 ));
let qInverse: THREE.Quaternion = q.clone().inverse();
let offset: THREE.Vector3 = new THREE.Vector3();
offset.copy(camera.lookat).sub(camera.position);
offset.applyQuaternion(q);
let length: number = offset.length();
let phi: number = Math.atan2(offset.y, offset.x);
phi += this._rotationDelta.phi;
let theta: number = Math.atan2(Math.sqrt(offset.x * offset.x + offset.y * offset.y), offset.z);
theta += this._rotationDelta.theta;
theta = Math.max(0.1, Math.min(Math.PI - 0.1, theta));
offset.x = Math.sin(theta) * Math.cos(phi);
offset.y = Math.sin(theta) * Math.sin(phi);
offset.z = Math.cos(theta);
offset.applyQuaternion(qInverse);
camera.lookat.copy(camera.position).add(offset.multiplyScalar(length));
}
示例2: update
update(world: World, control: Control) {
var beta = control.motionTracker.getBeta();
this._acceleration.copy(this._speed).divideScalar(30).clampLength(0.1, 3);
this._acceleration.applyAxisAngle(yAxis, horizontalRotation(beta));
this._speed.add(this._acceleration);
this._speed.clampLength(0, 80);
var newPos = new Vector3().addVectors(this._position, this._speed);
this._playerTracker.updateSection(newPos);
var collision = this._playerTracker.getCollision();
if (collision) {
newPos = collision;
this._speed.multiplyScalar(0.3);
newPos = this._playerTracker.getAdjusted(newPos);
this._position.copy(newPos);
} else {
newPos = this._playerTracker.getAdjusted(newPos);
this._acceleration.subVectors(newPos, this._position).sub(this._speed).clampLength(0, 5);
this._speed.add(this._acceleration);
this._position.add(this._speed);
}
this._direction.setFromUnitVectors(
new Vector3(0, 0, 1),
this._speed.clone().setY(0).setLength(1));
}
示例3: panUp
return function panUp( distance, objectMatrix ) {
v.setFromMatrixColumn( objectMatrix, 1 ); // get Y column of objectMatrix
v.multiplyScalar( distance );
panOffset.add( v );
};
示例4: handleVertex
function handleVertex(v) {
n.fromArray(normals, v * 3);
n2.copy(n);
t = tan1[v];
// Gram-Schmidt orthogonalize
tmp.copy(t);
tmp.sub(n.multiplyScalar(n.dot(t))).normalize();
// Calculate handedness
tmp2.crossVectors(n2, t);
test = tmp2.dot(tan2[v]);
w = (test < 0.0) ? - 1.0 : 1.0;
tangents[v * 4] = tmp.x;
tangents[v * 4 + 1] = tmp.y;
tangents[v * 4 + 2] = tmp.z;
tangents[v * 4 + 3] = w;
}
示例5: _setPanVector
private _setPanVector (x: number, y: number, z = 0) {
const scaleFactor = this.controls.getCanvasScaleFactor(z)
tmpPanVector.set(x, y, 0)
tmpPanVector.multiplyScalar(this.panSpeed * scaleFactor)
}