Skip to content

Commit

Permalink
Merge pull request #113 from LeXXik/attr-init
Browse files Browse the repository at this point in the history
Fix attributes initialization
  • Loading branch information
LeXXik authored Nov 7, 2024
2 parents 3c676db + 1bf0331 commit fec14d4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/physics/jolt/front/system.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Debug } from '../debug.mjs';
import { buildAccessors } from '../../util.mjs';
import { BUFFER_WRITE_UINT32 } from '../constants.mjs';
import { ComponentSystem } from 'playcanvas';
import { ComponentSystem, Quat, Vec3 } from 'playcanvas';

class JoltComponentSystem extends ComponentSystem {
_store = {};
Expand Down Expand Up @@ -89,7 +89,12 @@ class JoltComponentSystem extends ComponentSystem {
if ($_DEBUG) {
Debug.assert(value != null, `Trying to initialize a component with invalid value for property "${key}": ${value}`, data);
}
component[`_${key}`] = value;

if (value instanceof Vec3 || value instanceof Quat) {
component[`_${key}`] = value.clone();
} else {
component[`_${key}`] = value;
}
}

if (component.entity.enabled) {
Expand Down

0 comments on commit fec14d4

Please sign in to comment.