Hello, I am working on a game and I got a new player model. I tried using the first-person script but the camera doesn’t work and it blows up player.
I’m not totally sure what you mean, but I guess it has to with collision and a dynamic rigidbody.
Then you need to find out what is causing it. Based on the picture I think maybe the animation you use is causing the different scale. Can you check the result without animation?
I turned it off and the model is still huge
I assume it’s not huge in the editor?
If you share the editor link of your project, someone can take a look.
It looks like it’s because you didn’t assign the camera entity to the script attribute.
Because of that, the script is creating a new camera at runtime.
Not sure why that causes the scale different to be honest.
@Codeknight999 I have noticed that the scales on your asset are changed like below.
Have you tried changing the scale setting on your model.
Also, The reason it will not run properly is due to this error.
var Move = pc.createScript('move');
// initialize code called once per entity
Move.prototype.initialize = function() {
};
// update code called every frame
Move.prototype.update = function(dt) {
if(this.app.keyboard.isPressed(pc.KEY_W)){
this.entity.rigidbody.applyForce(100,0,0)
}
};
if(this.app.keyboard.isPressed(pc.KEY_D)){
this.entity.rotatelocal(0,5,0)
};
// swap method called for script hot-reloading
// inherit your script state here
// Move.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// https://developer.playcanvas.com/en/user-manual/scripting/
I notice that too, but the scale was changing at runtime. If a scale of 5 is good in the editor, then it should be good at runtime too?
Thanks, I will look into this.