Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Physics Iteration 9 #13545

Merged
merged 2 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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