https://playcanvas.com/editor/scene/603115
Hello.
Don’t know how i’ve got this problems when trying to launch my project:
1.[orbit-camera.js?id=11965532:287]: Cannot read property ‘length’ of null
2.[keyboard-input.js?id=11965511:14]: Cannot read property ‘clone’ of undefined
Can somebody help me please?
You have a entity named roof2
that has a model component with no mesh and the orbit camera script naively assumes that every model component has a mesh.

You can either fix this by deleting that entity or by changing the code of the _buildAabb
function to:
OrbitCamera.prototype._buildAabb = function (entity, modelsAdded) {
var i = 0;
if (entity.model) {
var mi = entity.model.meshInstances;
if (mi) {
for (i = 0; i < mi.length; i++) {
if (modelsAdded === 0) {
this._modelsAabb.copy(mi[i].aabb);
} else {
this._modelsAabb.add(mi[i].aabb);
}
modelsAdded += 1;
}
}
}
for (i = 0; i < entity.children.length; ++i) {
modelsAdded += this._buildAabb(entity.children[i], modelsAdded);
}
return modelsAdded;
};
1 Like
I have tried countless times to fix this problem, i did what this forum said and followed a few tutorials but i can fix the error code Uncaught TypeError: Cannot read property ‘clone’ of undefined.
please help me.
here is the project
https://playcanvas.com/editor/scene/1070381
and now after i tried to define it, it tells me this: Uncaught TypeError: Cannot read property ‘clone’ of null
with the same line of code still being a problem
Hi @Sledge_Gates1 and welcome,
The reason that happens in your case is because of this line, this.bullet
is undefined in your case:
You haven’t referenced any entity in editor to be the bullet:
Fix that, and that error will go away.
1 Like
the thing is though, if you click on player, bullet should be right underneath target. which is under screen
Yeah, but in your code this.bullet
is a script attribute, that means you need to drag and drop it on the Bullet field in editor.
That would be here:
i must’ve forgotten to click it. thank you guys so much! i’m gonna go test it and i’ll come back if it doesn’t work
1 Like
Hello! I’m currently making a fps game, launching the game so far works well but, when added a character animation as enemy, it suddenly says, [playcanvas-stable.dbg.js:18545]: Cannot read properties of undefined (reading ‘name’)
Here is the link of my playcanva: https://playcanvas.com/editor/scene/1246467