Hello, guys i used code i found on forum for virtual joystick character movement
had to rework it so it works in my project, but there is something i dont know to make work.
Here is function which makes my player move
As you can see it is using camera to move and orientate i guess.
And when camera is not centered with player then he is not running in straight line but it is trying to make it going straing related to camera position, and so movement is messed. I dont want to use camera to move character but the player, i tried to change this.camera .forward and this.camera.right
for this.entity.forward and so as with right, but that didnt really help as the character was moving even more strange, it wasnt related to camera, but neither to the player i think, or maybe i dont know how to use that forward and right functions.
I also defined those in initialize
this.force = new pc.Vec3();
this.right = new pc.Vec3();
Here is full code: https://playcanvas.com/editor/code/733989?tabs=39056987
But you as well can use link to editor: https://playcanvas.com/editor/scene/1130613
does anybody know how to change it properly, or does anybody see any issue in the code? Thank you
To exactly understand my problem, please, hit play button and try to go forward.