Hi there,
I’ve been trying to make a character (characterMesh) and an obstacle (obstacleMesh) that, when touching, will make the character lose health. However, my code it throwing an error that I’m having trouble with fixing. What I think the error is saying is that the vertices are undefined, but I already have defined it with a value of 32, and I am using BufferGeometry for my character. Here’s the code that I believe is throwing the error:
Any sort of assistance would be appreciated.
What line are you getting the error on?
Anywhere that the characterMesh’s vertices’ length or just where the vertices themselves are used.
Since you’re only showing an excerpt of the relevant code and only at miniscule resolution, I can only guess:
this kind of error typically occurs, when you are using/accessing a variable which
- has not been set yet
- is not visible (scope) in a certain block of code.
To track these types of error, fire up your debugger and try to “view” the content of the variable in question. A good place for a breakpoint would be the line starting the “for”-loop.
P.S.:
I just checked: it appears that Mesh.geometry
doesn’t even have a member “vertices
”:
Thanks for the quick answer, I fixed the error. Thank you so much!