Skip to content

Commit

Permalink
Build
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofugaro committed Feb 3, 2021
1 parent baecdc6 commit 81ec98b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
19 changes: 19 additions & 0 deletions dist/cannon-es.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3670,6 +3670,25 @@ class Body extends EventTarget {
this.vectorToWorldFrame(localPoint, relativePointWorld);
this.applyForce(worldForce, relativePointWorld);
}
/**
* Apply torque to the body.
* @method applyTorque
* @param {Vec3} torque The amount of torque to add.
*/


applyTorque(torque) {
if (this.type !== Body.DYNAMIC) {
return;
}

if (this.sleepState === Body.SLEEPING) {
this.wakeUp();
} // Add rotational force


this.torque.vadd(torque, this.torque);
}
/**
* Apply impulse to a point of the body. This could for example be a point on the Body surface.
* An impulse is a force added to a body during a short period of time (impulse = force * time).
Expand Down
1 change: 1 addition & 0 deletions dist/cannon-es.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ declare module "objects/Body" {
updateInertiaWorld(force?: boolean): void;
applyForce(force: Vec3, relativePoint?: Vec3): void;
applyLocalForce(localForce: Vec3, localPoint?: Vec3): void;
applyTorque(torque: Vec3): void;
applyImpulse(impulse: Vec3, relativePoint?: Vec3): void;
applyLocalImpulse(localImpulse: Vec3, localPoint?: Vec3): void;
updateMassProperties(): void;
Expand Down
19 changes: 19 additions & 0 deletions dist/cannon-es.js
Original file line number Diff line number Diff line change
Expand Up @@ -3666,6 +3666,25 @@ class Body extends EventTarget {
this.vectorToWorldFrame(localPoint, relativePointWorld);
this.applyForce(worldForce, relativePointWorld);
}
/**
* Apply torque to the body.
* @method applyTorque
* @param {Vec3} torque The amount of torque to add.
*/


applyTorque(torque) {
if (this.type !== Body.DYNAMIC) {
return;
}

if (this.sleepState === Body.SLEEPING) {
this.wakeUp();
} // Add rotational force


this.torque.vadd(torque, this.torque);
}
/**
* Apply impulse to a point of the body. This could for example be a point on the Body surface.
* An impulse is a force added to a body during a short period of time (impulse = force * time).
Expand Down
1 change: 0 additions & 1 deletion src/objects/Body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ export class Body extends EventTarget {
this.torque.vadd(torque, this.torque)
}


/**
* Apply impulse to a point of the body. This could for example be a point on the Body surface.
* An impulse is a force added to a body during a short period of time (impulse = force * time).
Expand Down

0 comments on commit 81ec98b

Please sign in to comment.