Time.deltaTime更正
ArcadeRigidbody优化
This commit is contained in:
13
source/bin/framework.d.ts
vendored
13
source/bin/framework.d.ts
vendored
@@ -462,6 +462,13 @@ declare module es {
|
|||||||
* @param value2
|
* @param value2
|
||||||
*/
|
*/
|
||||||
static multiply(value1: Vector2, value2: Vector2): Vector2;
|
static multiply(value1: Vector2, value2: Vector2): Vector2;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param value1
|
||||||
|
* @param value2
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
static multiplyScaler(value1: Vector2, value2: number): Vector2;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param value1
|
* @param value1
|
||||||
@@ -541,6 +548,12 @@ declare module es {
|
|||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
multiply(value: Vector2): Vector2;
|
multiply(value: Vector2): Vector2;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
multiplyScaler(value: number): Vector2;
|
||||||
/**
|
/**
|
||||||
* 从当前Vector2减去一个Vector2
|
* 从当前Vector2减去一个Vector2
|
||||||
* @param value 要减去的Vector2
|
* @param value 要减去的Vector2
|
||||||
|
|||||||
@@ -1142,6 +1142,18 @@ var es;
|
|||||||
result.y = value1.y * value2.y;
|
result.y = value1.y * value2.y;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param value1
|
||||||
|
* @param value2
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
Vector2.multiplyScaler = function (value1, value2) {
|
||||||
|
var result = new Vector2(0, 0);
|
||||||
|
result.x = value1.x * value2;
|
||||||
|
result.y = value1.x * value2;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param value1
|
* @param value1
|
||||||
@@ -1266,6 +1278,16 @@ var es;
|
|||||||
this.y *= value.y;
|
this.y *= value.y;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
Vector2.prototype.multiplyScaler = function (value) {
|
||||||
|
this.x *= value;
|
||||||
|
this.y *= value;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* 从当前Vector2减去一个Vector2
|
* 从当前Vector2减去一个Vector2
|
||||||
* @param value 要减去的Vector2
|
* @param value 要减去的Vector2
|
||||||
@@ -2236,8 +2258,8 @@ var es;
|
|||||||
*/
|
*/
|
||||||
ArcadeRigidbody.prototype.addImpulse = function (force) {
|
ArcadeRigidbody.prototype.addImpulse = function (force) {
|
||||||
if (!this.isImmovable) {
|
if (!this.isImmovable) {
|
||||||
this.velocity = es.Vector2.add(this.velocity, es.Vector2.multiply(force, new es.Vector2(100000))
|
this.velocity = this.velocity.add(es.Vector2.multiplyScaler(force, 100000)
|
||||||
.multiply(new es.Vector2(this._inverseMass * es.Time.deltaTime)));
|
.multiplyScaler(this._inverseMass * es.Time.deltaTime * es.Time.deltaTime));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ArcadeRigidbody.prototype.onAddedToEntity = function () {
|
ArcadeRigidbody.prototype.onAddedToEntity = function () {
|
||||||
@@ -2251,8 +2273,8 @@ var es;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.shouldUseGravity)
|
if (this.shouldUseGravity)
|
||||||
this.velocity = es.Vector2.add(this.velocity, es.Vector2.multiply(es.Physics.gravity, new es.Vector2(es.Time.deltaTime)));
|
this.velocity = this.velocity.add(es.Vector2.multiplyScaler(es.Physics.gravity, es.Time.deltaTime));
|
||||||
this.entity.transform.position = es.Vector2.add(this.entity.transform.position, es.Vector2.multiply(this.velocity, new es.Vector2(es.Time.deltaTime)));
|
this.entity.transform.position = this.entity.transform.position.add(es.Vector2.multiplyScaler(this.velocity, es.Time.deltaTime));
|
||||||
var collisionResult = new es.CollisionResult();
|
var collisionResult = new es.CollisionResult();
|
||||||
// 捞取我们在新的位置上可能会碰撞到的任何东西
|
// 捞取我们在新的位置上可能会碰撞到的任何东西
|
||||||
var neighbors = es.Physics.boxcastBroadphaseExcludingSelfNonRect(this._collider, this._collider.collidesWithLayers.value);
|
var neighbors = es.Physics.boxcastBroadphaseExcludingSelfNonRect(this._collider, this._collider.collidesWithLayers.value);
|
||||||
@@ -2272,10 +2294,10 @@ var es;
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// 没有ArcadeRigidbody,所以我们假设它是不动的,只移动我们自己的
|
// 没有ArcadeRigidbody,所以我们假设它是不动的,只移动我们自己的
|
||||||
this.entity.transform.position = es.Vector2.subtract(this.entity.transform.position, collisionResult.minimumTranslationVector);
|
this.entity.transform.position = this.entity.transform.position.subtract(collisionResult.minimumTranslationVector);
|
||||||
var relativeVelocity = this.velocity.clone();
|
var relativeVelocity = this.velocity.clone();
|
||||||
this.calculateResponseVelocity(relativeVelocity, collisionResult.minimumTranslationVector, relativeVelocity);
|
this.calculateResponseVelocity(relativeVelocity, collisionResult.minimumTranslationVector, relativeVelocity);
|
||||||
this.velocity = es.Vector2.add(this.velocity, relativeVelocity);
|
this.velocity = this.velocity.add(relativeVelocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2295,14 +2317,14 @@ var es;
|
|||||||
*/
|
*/
|
||||||
ArcadeRigidbody.prototype.processOverlap = function (other, minimumTranslationVector) {
|
ArcadeRigidbody.prototype.processOverlap = function (other, minimumTranslationVector) {
|
||||||
if (this.isImmovable) {
|
if (this.isImmovable) {
|
||||||
other.entity.transform.position = es.Vector2.add(other.entity.transform.position, minimumTranslationVector);
|
other.entity.transform.position = other.entity.transform.position.add(minimumTranslationVector);
|
||||||
}
|
}
|
||||||
else if (other.isImmovable) {
|
else if (other.isImmovable) {
|
||||||
this.entity.transform.position = es.Vector2.subtract(this.entity.transform.position, minimumTranslationVector);
|
this.entity.transform.position = this.entity.transform.position.subtract(minimumTranslationVector);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.entity.transform.position = es.Vector2.subtract(this.entity.transform.position, es.Vector2.multiply(minimumTranslationVector, es.Vector2Ext.halfVector()));
|
this.entity.transform.position = this.entity.transform.position.subtract(es.Vector2.multiplyScaler(minimumTranslationVector, 0.5));
|
||||||
other.entity.transform.position = es.Vector2.add(other.entity.transform.position, es.Vector2.multiply(minimumTranslationVector, es.Vector2Ext.halfVector()));
|
other.entity.transform.position = other.entity.transform.position.add(es.Vector2.multiplyScaler(minimumTranslationVector, 0.5));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@@ -2320,8 +2342,8 @@ var es;
|
|||||||
var totalinverseMass = this._inverseMass + other._inverseMass;
|
var totalinverseMass = this._inverseMass + other._inverseMass;
|
||||||
var ourResponseFraction = this._inverseMass / totalinverseMass;
|
var ourResponseFraction = this._inverseMass / totalinverseMass;
|
||||||
var otherResponseFraction = other._inverseMass / totalinverseMass;
|
var otherResponseFraction = other._inverseMass / totalinverseMass;
|
||||||
this.velocity = es.Vector2.add(this.velocity, new es.Vector2(relativeVelocity.x * ourResponseFraction, relativeVelocity.y * ourResponseFraction));
|
this.velocity = this.velocity.add(es.Vector2.multiplyScaler(relativeVelocity, ourResponseFraction));
|
||||||
other.velocity = es.Vector2.subtract(other.velocity, new es.Vector2(relativeVelocity.x * otherResponseFraction, relativeVelocity.y * otherResponseFraction));
|
other.velocity = other.velocity.subtract(es.Vector2.multiplyScaler(relativeVelocity, otherResponseFraction));
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 给定两个物体和MTV之间的相对速度,本方法修改相对速度,使其成为碰撞响应
|
* 给定两个物体和MTV之间的相对速度,本方法修改相对速度,使其成为碰撞响应
|
||||||
@@ -2332,12 +2354,12 @@ var es;
|
|||||||
ArcadeRigidbody.prototype.calculateResponseVelocity = function (relativeVelocity, minimumTranslationVector, responseVelocity) {
|
ArcadeRigidbody.prototype.calculateResponseVelocity = function (relativeVelocity, minimumTranslationVector, responseVelocity) {
|
||||||
if (responseVelocity === void 0) { responseVelocity = new es.Vector2(); }
|
if (responseVelocity === void 0) { responseVelocity = new es.Vector2(); }
|
||||||
// 首先,我们得到反方向的归一化MTV:表面法线
|
// 首先,我们得到反方向的归一化MTV:表面法线
|
||||||
var inverseMTV = es.Vector2.multiply(minimumTranslationVector, new es.Vector2(-1));
|
var inverseMTV = es.Vector2.multiplyScaler(minimumTranslationVector, -1);
|
||||||
var normal = es.Vector2.normalize(inverseMTV);
|
var normal = es.Vector2.normalize(inverseMTV);
|
||||||
// 速度是沿碰撞法线和碰撞平面分解的。
|
// 速度是沿碰撞法线和碰撞平面分解的。
|
||||||
// 弹性将影响沿法线的响应(法线速度分量),摩擦力将影响速度的切向分量(切向速度分量)
|
// 弹性将影响沿法线的响应(法线速度分量),摩擦力将影响速度的切向分量(切向速度分量)
|
||||||
var n = es.Vector2.dot(relativeVelocity, normal);
|
var n = es.Vector2.dot(relativeVelocity, normal);
|
||||||
var normalVelocityComponent = new es.Vector2(normal.x * n, normal.y * n);
|
var normalVelocityComponent = es.Vector2.multiplyScaler(normal, n);
|
||||||
var tangentialVelocityComponent = es.Vector2.subtract(relativeVelocity, normalVelocityComponent);
|
var tangentialVelocityComponent = es.Vector2.subtract(relativeVelocity, normalVelocityComponent);
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
normalVelocityComponent = es.Vector2.zero;
|
normalVelocityComponent = es.Vector2.zero;
|
||||||
@@ -2346,11 +2368,8 @@ var es;
|
|||||||
if (tangentialVelocityComponent.lengthSquared() < this._glue)
|
if (tangentialVelocityComponent.lengthSquared() < this._glue)
|
||||||
coefficientOfFriction = 1.01;
|
coefficientOfFriction = 1.01;
|
||||||
// 弹性影响速度的法向分量,摩擦力影响速度的切向分量
|
// 弹性影响速度的法向分量,摩擦力影响速度的切向分量
|
||||||
var t = es.Vector2.multiply(new es.Vector2((1 + this._elasticity)), normalVelocityComponent)
|
responseVelocity = es.Vector2.multiplyScaler(normalVelocityComponent, -(1 + this._elasticity))
|
||||||
.multiply(new es.Vector2(-1))
|
.subtract(es.Vector2.multiplyScaler(tangentialVelocityComponent, coefficientOfFriction));
|
||||||
.subtract(es.Vector2.multiply(new es.Vector2(coefficientOfFriction), tangentialVelocityComponent));
|
|
||||||
responseVelocity.x = t.x;
|
|
||||||
relativeVelocity.y = t.y;
|
|
||||||
};
|
};
|
||||||
return ArcadeRigidbody;
|
return ArcadeRigidbody;
|
||||||
}(es.Component));
|
}(es.Component));
|
||||||
@@ -5131,7 +5150,7 @@ var es;
|
|||||||
currentTime = Date.now();
|
currentTime = Date.now();
|
||||||
if (this._lastTime == -1)
|
if (this._lastTime == -1)
|
||||||
this._lastTime = currentTime;
|
this._lastTime = currentTime;
|
||||||
var dt = currentTime - this._lastTime;
|
var dt = (currentTime - this._lastTime) / 1000;
|
||||||
if (dt > this.maxDeltaTime)
|
if (dt > this.maxDeltaTime)
|
||||||
dt = this.maxDeltaTime;
|
dt = this.maxDeltaTime;
|
||||||
this.totalTime += dt;
|
this.totalTime += dt;
|
||||||
|
|||||||
2
source/bin/framework.min.js
vendored
2
source/bin/framework.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -122,8 +122,8 @@ module es {
|
|||||||
*/
|
*/
|
||||||
public addImpulse(force: Vector2) {
|
public addImpulse(force: Vector2) {
|
||||||
if (!this.isImmovable) {
|
if (!this.isImmovable) {
|
||||||
this.velocity = Vector2.add(this.velocity, Vector2.multiply(force, new Vector2(100000))
|
this.velocity = this.velocity.add(Vector2.multiplyScaler(force, 100000)
|
||||||
.multiply(new Vector2(this._inverseMass * Time.deltaTime)));
|
.multiplyScaler(this._inverseMass * Time.deltaTime * Time.deltaTime));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,9 +139,9 @@ module es {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.shouldUseGravity)
|
if (this.shouldUseGravity)
|
||||||
this.velocity = Vector2.add(this.velocity, Vector2.multiply(Physics.gravity, new Vector2(Time.deltaTime)));
|
this.velocity = this.velocity.add(Vector2.multiplyScaler(Physics.gravity, Time.deltaTime));
|
||||||
|
|
||||||
this.entity.transform.position = Vector2.add(this.entity.transform.position, Vector2.multiply(this.velocity, new Vector2(Time.deltaTime)));
|
this.entity.transform.position = this.entity.transform.position.add(Vector2.multiplyScaler(this.velocity, Time.deltaTime));
|
||||||
let collisionResult = new CollisionResult();
|
let collisionResult = new CollisionResult();
|
||||||
|
|
||||||
// 捞取我们在新的位置上可能会碰撞到的任何东西
|
// 捞取我们在新的位置上可能会碰撞到的任何东西
|
||||||
@@ -154,16 +154,16 @@ module es {
|
|||||||
|
|
||||||
if (this._collider.collidesWithNonMotion(neighbor, collisionResult)) {
|
if (this._collider.collidesWithNonMotion(neighbor, collisionResult)) {
|
||||||
// 如果附近有一个ArcadeRigidbody,我们就会处理完整的碰撞响应。如果没有,我们会根据附近是不可移动的来计算事情
|
// 如果附近有一个ArcadeRigidbody,我们就会处理完整的碰撞响应。如果没有,我们会根据附近是不可移动的来计算事情
|
||||||
let neighborRigidbody = neighbor.entity.getComponent<ArcadeRigidbody>(ArcadeRigidbody);
|
let neighborRigidbody = neighbor.entity.getComponent(ArcadeRigidbody);
|
||||||
if (neighborRigidbody != null) {
|
if (neighborRigidbody != null) {
|
||||||
this.processOverlap(neighborRigidbody, collisionResult.minimumTranslationVector);
|
this.processOverlap(neighborRigidbody, collisionResult.minimumTranslationVector);
|
||||||
this.processCollision(neighborRigidbody, collisionResult.minimumTranslationVector);
|
this.processCollision(neighborRigidbody, collisionResult.minimumTranslationVector);
|
||||||
} else {
|
} else {
|
||||||
// 没有ArcadeRigidbody,所以我们假设它是不动的,只移动我们自己的
|
// 没有ArcadeRigidbody,所以我们假设它是不动的,只移动我们自己的
|
||||||
this.entity.transform.position = Vector2.subtract(this.entity.transform.position, collisionResult.minimumTranslationVector);
|
this.entity.transform.position = this.entity.transform.position.subtract(collisionResult.minimumTranslationVector);
|
||||||
let relativeVelocity = this.velocity.clone();
|
let relativeVelocity = this.velocity.clone();
|
||||||
this.calculateResponseVelocity(relativeVelocity, collisionResult.minimumTranslationVector, relativeVelocity);
|
this.calculateResponseVelocity(relativeVelocity, collisionResult.minimumTranslationVector, relativeVelocity);
|
||||||
this.velocity = Vector2.add(this.velocity, relativeVelocity);
|
this.velocity = this.velocity.add(relativeVelocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,12 +176,12 @@ module es {
|
|||||||
*/
|
*/
|
||||||
public processOverlap(other: ArcadeRigidbody, minimumTranslationVector: Vector2) {
|
public processOverlap(other: ArcadeRigidbody, minimumTranslationVector: Vector2) {
|
||||||
if (this.isImmovable) {
|
if (this.isImmovable) {
|
||||||
other.entity.transform.position = Vector2.add(other.entity.transform.position, minimumTranslationVector);
|
other.entity.transform.position = other.entity.transform.position.add(minimumTranslationVector);
|
||||||
} else if (other.isImmovable) {
|
} else if (other.isImmovable) {
|
||||||
this.entity.transform.position = Vector2.subtract(this.entity.transform.position, minimumTranslationVector);
|
this.entity.transform.position = this.entity.transform.position.subtract(minimumTranslationVector);
|
||||||
} else {
|
} else {
|
||||||
this.entity.transform.position = Vector2.subtract(this.entity.transform.position, Vector2.multiply(minimumTranslationVector, Vector2Ext.halfVector()));
|
this.entity.transform.position = this.entity.transform.position.subtract(Vector2.multiplyScaler(minimumTranslationVector, 0.5));
|
||||||
other.entity.transform.position = Vector2.add(other.entity.transform.position, Vector2.multiply(minimumTranslationVector, Vector2Ext.halfVector()));
|
other.entity.transform.position = other.entity.transform.position.add(Vector2.multiplyScaler(minimumTranslationVector, 0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,8 +203,8 @@ module es {
|
|||||||
let ourResponseFraction = this._inverseMass / totalinverseMass;
|
let ourResponseFraction = this._inverseMass / totalinverseMass;
|
||||||
let otherResponseFraction = other._inverseMass / totalinverseMass;
|
let otherResponseFraction = other._inverseMass / totalinverseMass;
|
||||||
|
|
||||||
this.velocity = Vector2.add(this.velocity, new Vector2(relativeVelocity.x * ourResponseFraction, relativeVelocity.y * ourResponseFraction));
|
this.velocity = this.velocity.add(Vector2.multiplyScaler(relativeVelocity, ourResponseFraction));
|
||||||
other.velocity = Vector2.subtract(other.velocity, new Vector2(relativeVelocity.x * otherResponseFraction, relativeVelocity.y * otherResponseFraction));
|
other.velocity = other.velocity.subtract(Vector2.multiplyScaler(relativeVelocity, otherResponseFraction));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,14 +215,14 @@ module es {
|
|||||||
*/
|
*/
|
||||||
public calculateResponseVelocity(relativeVelocity: Vector2, minimumTranslationVector: Vector2, responseVelocity: Vector2 = new Vector2()) {
|
public calculateResponseVelocity(relativeVelocity: Vector2, minimumTranslationVector: Vector2, responseVelocity: Vector2 = new Vector2()) {
|
||||||
// 首先,我们得到反方向的归一化MTV:表面法线
|
// 首先,我们得到反方向的归一化MTV:表面法线
|
||||||
let inverseMTV = Vector2.multiply(minimumTranslationVector, new Vector2(-1));
|
let inverseMTV = Vector2.multiplyScaler(minimumTranslationVector, -1);
|
||||||
let normal = Vector2.normalize(inverseMTV);
|
let normal = Vector2.normalize(inverseMTV);
|
||||||
|
|
||||||
// 速度是沿碰撞法线和碰撞平面分解的。
|
// 速度是沿碰撞法线和碰撞平面分解的。
|
||||||
// 弹性将影响沿法线的响应(法线速度分量),摩擦力将影响速度的切向分量(切向速度分量)
|
// 弹性将影响沿法线的响应(法线速度分量),摩擦力将影响速度的切向分量(切向速度分量)
|
||||||
let n = Vector2.dot(relativeVelocity, normal);
|
let n = Vector2.dot(relativeVelocity, normal);
|
||||||
|
|
||||||
let normalVelocityComponent = new Vector2(normal.x * n, normal.y * n);
|
let normalVelocityComponent = Vector2.multiplyScaler(normal, n);
|
||||||
let tangentialVelocityComponent = Vector2.subtract(relativeVelocity, normalVelocityComponent);
|
let tangentialVelocityComponent = Vector2.subtract(relativeVelocity, normalVelocityComponent);
|
||||||
|
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
@@ -234,11 +234,8 @@ module es {
|
|||||||
coefficientOfFriction = 1.01;
|
coefficientOfFriction = 1.01;
|
||||||
|
|
||||||
// 弹性影响速度的法向分量,摩擦力影响速度的切向分量
|
// 弹性影响速度的法向分量,摩擦力影响速度的切向分量
|
||||||
let t = Vector2.multiply(new Vector2((1 + this._elasticity)), normalVelocityComponent)
|
responseVelocity = Vector2.multiplyScaler(normalVelocityComponent, -(1 + this._elasticity))
|
||||||
.multiply(new Vector2(-1))
|
.subtract(Vector2.multiplyScaler(tangentialVelocityComponent, coefficientOfFriction));
|
||||||
.subtract(Vector2.multiply(new Vector2(coefficientOfFriction), tangentialVelocityComponent));
|
|
||||||
responseVelocity.x = t.x;
|
|
||||||
relativeVelocity.y = t.y;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ module es {
|
|||||||
if (this._lastTime == -1)
|
if (this._lastTime == -1)
|
||||||
this._lastTime = currentTime;
|
this._lastTime = currentTime;
|
||||||
|
|
||||||
let dt = currentTime - this._lastTime;
|
let dt = (currentTime - this._lastTime) / 1000;
|
||||||
if (dt > this.maxDeltaTime)
|
if (dt > this.maxDeltaTime)
|
||||||
dt = this.maxDeltaTime;
|
dt = this.maxDeltaTime;
|
||||||
this.totalTime += dt;
|
this.totalTime += dt;
|
||||||
|
|||||||
@@ -66,6 +66,19 @@ module es {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param value1
|
||||||
|
* @param value2
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public static multiplyScaler(value1: Vector2, value2: number) {
|
||||||
|
let result = new Vector2(0, 0);
|
||||||
|
result.x = value1.x * value2;
|
||||||
|
result.y = value1.x * value2;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param value1
|
* @param value1
|
||||||
@@ -206,6 +219,17 @@ module es {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param value
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
public multiplyScaler(value: number): Vector2 {
|
||||||
|
this.x *= value;
|
||||||
|
this.y *= value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从当前Vector2减去一个Vector2
|
* 从当前Vector2减去一个Vector2
|
||||||
* @param value 要减去的Vector2
|
* @param value 要减去的Vector2
|
||||||
|
|||||||
Reference in New Issue
Block a user