Skip to content

Commit

Permalink
Physics Iteration 9 (#13545)
Browse files Browse the repository at this point in the history
* Physics Iteration 9

* code format

---------

Co-authored-by: Cedric Guillemet <[email protected]>
  • Loading branch information
CedricGuillemet and CedricGuillemetMS authored Feb 17, 2023
1 parent a818869 commit a24f242
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions packages/dev/core/src/Physics/v2/IPhysicsEnginePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export enum ConstraintAxis {

/** @internal */
export enum ConstraintType {
BALL_AND_SOCKET,
DISTANCE,
HINGE,
SLIDER,
LOCK,
PRISMATIC,
BALL_AND_SOCKET = 1,
DISTANCE = 2,
HINGE = 3,
SLIDER = 4,
LOCK = 5,
PRISMATIC = 6,
}

/** @internal */
Expand Down Expand Up @@ -140,8 +140,8 @@ export interface IPhysicsEnginePluginV2 {
getAngularDamping(body: PhysicsBody): number;
setLinearVelocity(body: PhysicsBody, linVel: Vector3): void;
getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3): void;
applyImpulse(body: PhysicsBody, location: Vector3, impulse: Vector3): void;
applyForce(body: PhysicsBody, location: Vector3, force: Vector3): void;
applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3): void;
applyForce(body: PhysicsBody, force: Vector3, location: Vector3): void;
setAngularVelocity(body: PhysicsBody, angVel: Vector3): void;
getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3): void;
getBodyGeometry(body: PhysicsBody): {};
Expand Down
12 changes: 6 additions & 6 deletions packages/dev/core/src/Physics/v2/physicsBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,27 +285,27 @@ export class PhysicsBody {
/**
* Applies an impulse to the physics object.
*
* @param location The location of the impulse.
* @param impulse The impulse vector.
* @param location The location of the impulse.
*
* This method is useful for applying an impulse to a physics object, which can be used to simulate physical forces such as gravity,
* collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.
*/
public applyImpulse(location: Vector3, impulse: Vector3): void {
this._physicsPlugin.applyImpulse(this, location, impulse);
public applyImpulse(impulse: Vector3, location: Vector3): void {
this._physicsPlugin.applyImpulse(this, impulse, location);
}

/**
* Applies a force to the physics object.
*
* @param location The location of the force.
* @param force The force vector.
* @param location The location of the force.
*
* This method is useful for applying a force to a physics object, which can be used to simulate physical forces such as gravity,
* collisions, and explosions. This can be used to create realistic physics simulations in a game or other application.
*/
public applyForce(location: Vector3, force: Vector3): void {
this._physicsPlugin.applyForce(this, location, force);
public applyForce(force: Vector3, location: Vector3): void {
this._physicsPlugin.applyForce(this, force, location);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Physics/v2/physicsConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class PhysicsConstraint {
*/
constructor(type: ConstraintType, options: PhysicsConstraintParameters, scene: Scene) {
if (!scene) {
return;
throw new Error("Missing scene parameter for constraint constructor.");
}
const physicsEngine = scene.getPhysicsEngine();
if (!physicsEngine) {
Expand Down

0 comments on commit a24f242

Please sign in to comment.