BabylonJS/Babylon.js · error
No Physics Body for TransformNode
Error message
No Physics Body for TransformNode
What it means
The v2 physics component patches TransformNode.prototype.applyImpulse; it requires the node to have a `physicsBody` (created via `new PhysicsBody(node, ...)` or a PhysicsShape aggregation). Calling applyImpulse on a node without a body throws because there is nothing to apply the force to.
Source
Thrown at packages/dev/core/src/Physics/v2/physicsEngineComponent.pure.ts:64
/**
* Gets the current physics body
* @returns a physics body or null
*/
TransformNode.prototype.getPhysicsBody = function (): Nullable<PhysicsBody> {
return this.physicsBody;
};
/**
* Apply a physic impulse to the mesh
* @param force defines the force to apply
* @param contactPoint defines where to apply the force
* @returns the current mesh
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
*/
TransformNode.prototype.applyImpulse = function (force: Vector3, contactPoint: Vector3): TransformNode {
if (!this.physicsBody) {
throw new Error("No Physics Body for TransformNode");
}
this.physicsBody.applyImpulse(force, contactPoint);
return this;
};
/**
* Apply a physic angular impulse to the mesh
* @param angularImpulse defines the torque to apply
* @returns the current mesh
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
*/
TransformNode.prototype.applyAngularImpulse = function (angularImpulse: Vector3): TransformNode {
if (!this.physicsBody) {
throw new Error("No Physics Body for TransformNode");
}
this.physicsBody.applyAngularImpulse(angularImpulse);
return this;
};
View on GitHub (pinned to 0592b347b8)
Solutions
- Create a body first: `node.physicsBody = new PhysicsBody(node, PhysicsMotionType.DYNAMIC, false, scene)`
- Use `PhysicsShape` + `PhysicsBody` initialization helpers or character controllers that attach bodies automatically
- Guard calls with `if (node.physicsBody)` before applying impulses
- Confirm you are on the v2 API: bodies are `physicsBody`, not v1 `physicsImpostor`
Example fix
// before
node.applyImpulse(force, contactPoint); // throws: no body
// after
if (!node.physicsBody) {
node.physicsBody = new PhysicsBody(node, PhysicsMotionType.DYNAMIC, false, scene);
}
node.applyImpulse(force, contactPoint); Defensive patterns
Strategy: type-guard
Validate before calling
if (!node.physicsBody) {
node.physicsBody = new BABYLON.PhysicsBody(node, BABYLON.PhysicsMotionType.DYNAMIC, false, scene);
}
node.applyImpulse(force, contactPoint); Type guard
function hasPhysicsBody(node: BABYLON.TransformNode): node is BABYLON.TransformNode & { physicsBody: BABYLON.PhysicsBody } {
return !!node.physicsBody;
} Try / catch
try {
node.applyImpulse(force, contactPoint);
} catch (e) {
if (e.message.includes('No Physics Body')) {
node.physicsBody = new BABYLON.PhysicsBody(node, BABYLON.PhysicsMotionType.DYNAMIC, false, scene);
node.applyImpulse(force, contactPoint);
}
} Prevention
- Create the PhysicsBody immediately after mesh/TransformNode creation
- Do not dispose bodies while gameplay logic may still issue impulses
- Remember v2 uses physicsBody, not the v1 physicsImpostor property
When it happens
Trigger: Calling `transformNode.applyImpulse(force, contactPoint)` when `node.physicsBody` is undefined/null — body never created, already disposed, or created on a different node (e.g. the mesh instead of its TransformNode parent).
Common situations: Creating meshes without attaching a PhysicsBody while still calling impulse methods; disposing a body then continuing to simulate; using v1-style `mesh.physicsImpostor` code with the v2 API where the property is `physicsBody`.
Related errors
- No Physics Engine available.
- Plugin version is incorrect. Expected version 2.
- No Physics Plugin available.
- No Physics Engine available.
- Plugin version is incorrect. Expected version 2.
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/616c82760f1b2b5f.
Report an issue: GitHub.