Hi. I have a first-person project template I use for my students, which includes basic commands for jumping, movement, etc.
Starting today, when I try jumping in the sample project or any derivative projects, I am greeted with the following error:
[playcanvas-1.62.0.dbg.js:85370]: rayCallback.get_m_closestHitFraction is not a function
TypeError: rayCallback.get_m_closestHitFraction is not a function
at RigidBodyComponentSystem.raycastFirst (https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:85370:151)
at FirstPersonMovement.update (https://launch.playcanvas.com/api/assets/files/Scripts/first-person-movement.js?id=52637610&branchId=94438020-a78c-4bae-93ba-901be4bfefa1:118:46)
at ScriptComponent._scriptMethod (https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:93896:22)
at ScriptComponent._onUpdate (https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:93930:15)
at ScriptComponentSystem._callComponentMethod (https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:94578:52)
at ScriptComponentSystem._onUpdate (https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:94596:11)
at ComponentSystemRegistry.fire (https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:947:21)
at Application.update (https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:61925:19)
at https://code.playcanvas.com/playcanvas-1.62.0.dbg.js:62974:20
I have tried playing with the code I’m using, including removing the callback from the code I had, but this error persists. Here is the code that used to work, but now elicits a problem:
if(app.keyboard.wasPressed(pc.KEY_SPACE)){
var pos = this.entity.getPosition();
this.rayEnd.add2(pos, this.groundCheckRay);
var onGround = false;
// Fire a ray straight down to just below the bottom of the rigid body,
// if it hits something then the character is standing on something.
app.systems.rigidbody.raycastFirst(pos, this.rayEnd, function (result) {
onGround = true;
});
if(onGround){
jumpforce.set(0, this.jumppower*15, 0);
this.entity.rigidbody.applyForce(force);
}
}
Any advice for getting this code working again? Or is this a symptom of some bugged update to PlayCanvas? It looks like the problem may be in the codebase for raycastFirst() itself?