What do you think is the reason why the ball vibrates when I play on mobile in my game?
( It doesn’t work when you hit the obstacles in the game. I haven’t done them yet. Refresh the page to start over in the game.)
What do you think is the reason why the ball vibrates when I play on mobile in my game?
( It doesn’t work when you hit the obstacles in the game. I haven’t done them yet. Refresh the page to start over in the game.)
Could you elaborate on what you mean by the ball vibrating, or show a video? If I had to guess based on the last time you had a similar issue on a different project, your framerate is dropping because you have a lot of logic in your update loop.
I guess this is a camera issue, because I see the problem also on my laptop. Do you move your camera with a script? A link to the editor of your project would be nice.
var CameraController = pc.createScript('cameraController');
CameraController.attributes.add('Sphere',{
type: 'entity'
});
CameraController.attributes.add('offset',{
type: 'vec3'
});
// initialize code called once per entity
CameraController.prototype.initialize = function() {
this.offset = this.entity.getPosition().sub(this.Sphere.getPosition());
};
// update code called every frame
CameraController.prototype.update = function(dt) {
this.entity.setPosition(this.Sphere.getPosition().add(this.offset));
};
// swap method called for script hot-reloading
// inherit your script state here
// CameraController.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// https://developer.playcanvas.com/en/user-manual/scripting/
Try to use postUpdate
instead of update
.
var CameraController = pc.createScript('cameraController');
CameraController.attributes.add('Sphere',{
type: 'entity'
});
CameraController.attributes.add('offset',{
type: 'vec3'
});
// initialize code called once per entity
CameraController.prototype.initialize = function() {
this.offset = this.entity.getPosition().sub(this.Sphere.getPosition());
};
// update code called every frame
CameraController.prototype.postUpdate = function(dt) {
this.entity.setPosition(this.Sphere.getPosition().add(this.offset));
};
[quote=“Albertos, post:5, topic:22925”]
postUpdate
[/quote]
i will try
[image]