From 6b313e66a56c8090d1f666c452de93cb9c8bd9b3 Mon Sep 17 00:00:00 2001 From: Renaud Rohlinger Date: Fri, 24 Apr 2026 19:15:36 +0900 Subject: [PATCH 1/2] RenderObject: Guard against undefined geometry attribute in getAttributes() (#33460) --- src/renderers/common/RenderObject.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/renderers/common/RenderObject.js b/src/renderers/common/RenderObject.js index 14bf7600751605..7ce552eae7fd5f 100644 --- a/src/renderers/common/RenderObject.js +++ b/src/renderers/common/RenderObject.js @@ -511,7 +511,12 @@ class RenderObject { // geometry attribute attribute = geometry.getAttribute( nodeAttribute.name ); - attributesId[ nodeAttribute.name ] = attribute.id; + + if ( attribute !== undefined ) { + + attributesId[ nodeAttribute.name ] = attribute.id; + + } } From 083a11c06704e31f67f4fbcc988801dbff81e20c Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Fri, 24 Apr 2026 12:18:31 +0200 Subject: [PATCH 2/2] RapierPhysics: Add `applyImpulse()`. (#33459) --- examples/jsm/physics/RapierPhysics.js | 29 +++++++++++++++++++++++-- examples/physics_rapier_instancing.html | 25 ++++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/examples/jsm/physics/RapierPhysics.js b/examples/jsm/physics/RapierPhysics.js index f2c7fa3af3d32e..09761d94f8f9d1 100644 --- a/examples/jsm/physics/RapierPhysics.js +++ b/examples/jsm/physics/RapierPhysics.js @@ -281,6 +281,20 @@ async function RapierPhysics() { } + function applyImpulse( mesh, impulse, index = 0 ) { + + let { body } = meshMap.get( mesh ); + + if ( mesh.isInstancedMesh ) { + + body = body[ index ]; + + } + + body.applyImpulse( impulse, true ); + + } + function addHeightfield( mesh, width, depth, heights, scale ) { const shape = RAPIER.ColliderDesc.heightfield( width, depth, heights, scale ); @@ -414,7 +428,7 @@ async function RapierPhysics() { /** * Adds a heightfield terrain to the physics simulation. - * + * * @method * @name RapierPhysics#addHeightfield * @param {Mesh} mesh - The Three.js mesh representing the terrain. @@ -427,7 +441,18 @@ async function RapierPhysics() { * @param {number} scale.z - Scale factor for depth. * @returns {RigidBody} The created Rapier rigid body for the heightfield. */ - addHeightfield: addHeightfield + addHeightfield: addHeightfield, + + /** + * Applies an impulse to the given mesh which is part of the physics simulation. + * + * @method + * @name RapierPhysics#applyImpulse + * @param {Mesh} mesh - The mesh to apply the impulse to. + * @param {Vector3} impulse - The impulse to apply. + * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. + */ + applyImpulse: applyImpulse }; diff --git a/examples/physics_rapier_instancing.html b/examples/physics_rapier_instancing.html index 4a8cf2e5f09e42..b98267cdb02f5f 100644 --- a/examples/physics_rapier_instancing.html +++ b/examples/physics_rapier_instancing.html @@ -9,7 +9,8 @@
- three.js physics - rapier instancing + three.js physics - rapier instancing
+