So for the game that I’ve been working on for the past year not longer works due to the engine update….
Is it possible for me to run the game back on the previous previous version 1.63 something? I think 1.63
Nothing seems to work in all the new versions…
Please I’ve worked so hard and now everything is broken😭
Hey … just curious about what is broken? Perhaps a way forward would be to fix the compatibility issues to get it to work with the latest engine. Are you getting specific error messages you can share? Is it related to custom shaders?
1 Like
Can I privately message u my project?
PlayCanvas | HTML5 Game Engine Is an example of the of what my project is kind of like 
The example seems to run fine?
It’s the aiming… the character doesn’t look at the mouse
There is a raycast being made from the camera to the world and where ever the mouse is the character looks in that direction
That sounds like one thing, but not everything completely broken. I’d suggest to add some logging to your code, or breakpoints, to investigate what is happening there. I don’t think there were (many / any) changes in this area in the engine in months, perhaps there’s some issue in your script that needs to be fixed?
Well are more things broke but I can fix the those later…
(
sry I’ve been transitioning throughout the day at school…)
I can’t get that specific script to work like in any way shape of form…
Help please….
Idk how to fix it
var CharacterController = pc.createScript('characterController');
CharacterController.attributes.add("speed", {
type: "number",
default: 500
});
CharacterController.attributes.add("cameraEntity", {
type: "entity"
});
CharacterController.attributes.add("lookAtEntity", {
type: "entity"
});
CharacterController.attributes.add("stamina", {
type: "number",
default: 1
});
CharacterController.prototype.initialize = function(){
this.originalSpeed = this.speed;
this.active = false;
this.currentStamina = this.stamina;
// Listen for mouse move events
this.app.mouse.on(pc.EVENT_MOUSEMOVE, this._onMouseMove, this);
this.on('destroy', function() {
this.app.mouse.off(pc.EVENT_MOUSEMOVE, this._onMouseMove, this);
}, this);
};
// update code called every frame
CharacterController.prototype.update = function(dt) {
if (this.active) {
this.lookAtEntity.setPosition(this.entity.getPosition());
this.entity.children[0].lookAt(this.lookAtEntity.children[0].getPosition().x, this.entity.getPosition().y, this.lookAtEntity.children[0].getPosition().z);
}
//console.log(this.entity.rigidbody.linearVelocity.length());
if(this.app.keyboard.isPressed(pc.KEY_SHIFT) && this.currentStamina > 0 && this.entity.rigidbody.linearVelocity.length() > 1){
this.speed = this.originalSpeed * 2.5;
this.currentStamina -= dt;
}else{
this.speed = this.originalSpeed;
this.currentStamina += dt/4;
if(this.currentStamina > this.stamina){this.currentStamina = this.stamina;}
}
if(this.app.keyboard.isPressed(pc.KEY_W)){
this.entity.rigidbody.applyForce(this.speed, 0, 0);
}
if(this.app.keyboard.isPressed(pc.KEY_A)){
this.entity.rigidbody.applyForce(0, 0, -this.speed);
}
if(this.app.keyboard.isPressed(pc.KEY_S)){
this.entity.rigidbody.applyForce(-this.speed, 0, 0);
}
if(this.app.keyboard.isPressed(pc.KEY_D)){
this.entity.rigidbody.applyForce(0, 0, this.speed);
}
};
CharacterController.__ray = new pc.Ray();
CharacterController.__hitPosition = new pc.Vec3();
CharacterController.prototype._onMouseMove = function (e) {
var cam = this.app.root.findByName('Camera');
var from = cam.camera.screenToWorld(e.x, e.y, cam.camera.nearClip);
var to = cam.camera.screenToWorld(e.x, e.y, cam.camera.farClip);
this.app.systems.rigidbody.raycastFirst(from, to, function (result) {
this.lookAtEntity.children[0].setPosition(result.point);
this.active = true;
}.bind(this));
};
// update code called every frame
CharacterController.prototype.postUpdate = function(dt) {
if (this.active) {
this.lookAtEntity.setPosition(this.entity.getPosition());
this.entity.children[0].lookAt(this.lookAtEntity.children[0].getPosition().x, this.entity.getPosition().y, this.lookAtEntity.children[0].getPosition().z);
}
};
That’s the script that I just can’t get to work…
Everything in the player(the children) should be facing in the direction of the lookAtEntity.
The lookAtEntity’s position is set to be where ever the mouse/camera screen to world is…
Thing is I just can’t get this to work anymore in the new version… I’ve tried many different approaches but those never worked…
Help