Skip to content

Commit 38e4b39

Browse files
Fix setMotionType with Physics instances (#16880)
1 parent b7ea4e7 commit 38e4b39

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/dev/core/src/Physics/v2/characterController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ export class PhysicsCharacterController {
232232
*/
233233
public dynamicFriction = 1;
234234
/**
235-
* cosine value of slop angle that can be climbed
235+
* cosine value of slope angle that can be climbed
236236
* computed as `Math.cos(Math.PI * (angleInDegree / 180.0));`
237237
* default 0.5 (value for a 60deg angle)
238238
*/

packages/dev/core/src/Physics/v2/physicsBody.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ export class PhysicsBody {
252252
/**
253253
* Sets the motion type of the physics body. Can be STATIC, DYNAMIC, or ANIMATED.
254254
* @param motionType - The motion type to set.
255-
* @param instanceIndex - If this body is instanced, the index of the instance to set the motion type for.
255+
* @param instanceIndex - If this body is instanced, the index of the instance to set the motion type for. If body is instanced but instanceIndex is undefined, the motion type will be set for all instances.
256256
*/
257257
public setMotionType(motionType: PhysicsMotionType, instanceIndex?: number) {
258-
this.disableSync = motionType == PhysicsMotionType.STATIC;
258+
this.disableSync = instanceIndex === undefined && motionType == PhysicsMotionType.STATIC;
259259
this._physicsPlugin.setMotionType(this, motionType, instanceIndex);
260260
}
261261

0 commit comments

Comments
 (0)