pmndrs / ecctrl

🕹️ A floating rigibody character controller
MIT License
465 stars 49 forks source link

JoystickDis joystickAng #41

Open lt15364967740 opened 3 months ago

lt15364967740 commented 3 months ago

Could you please explain the value range of setJoystick(joystickDis, joystickAng, runState) parameter? When I force the canvas to landscape, the gesture slide is perpendicular to the character movement direction, so I need to customize Joystick

ErdongChen-Andrew commented 3 months ago

When the canvas change to landscape, the joystick should automatically adjust to fit the canvas 🤔 joystickDis default is 0-65, but it may vary depending on the size of the joystick joystickAng is from 0-Math.PI runState is a boolean, when joystickDis is higher than 70% of its max value, this will become true

lt15364967740 commented 3 months ago

https://github.com/lt15364967740/test I used css to rotate the canvas to use landscape in portrait condition on the phone, I tried custom Joystick but the direction was still the opposite

ErdongChen-Andrew commented 3 months ago

Rotating the entire canvas using CSS could mess up the orientation. Typically, we just rotate the phone to achieve landscape view. Perhaps you could try rotating the joystick div as well, that might fix the issue.

lt15364967740 commented 3 months ago

When I rotate the css the slide is in the opposite direction of the gesture, but I don't know how to modify this coordinate and apply it to the camera

ErdongChen-Andrew commented 3 months ago

Sorry, there is no way to modify the followCam coordinate. Rotating the canvas in CSS is not a common approach. Even if you just use a simple orbicontrol, the orientation of the camera would be off.