Jump to content

VirtualJoysticksCamera - Left joystick speed


Recommended Posts

Hello, I am experiminting with the Virtual Joysticks Camera and I have a scene that is relatively large. when I use the left joystick to move the camera it moves really slow, I can't figure out how to change the speed of the left joystick. The right joystick(camera rotation) rotates just fine.


Thanks for the help!

Link to comment
Share on other sites

Hi Davrous!  Good to see you again!  Thanks for the feature add.


I toured a few BJS scenes from the main website last night, choosing 'virtual joysticks camera' from their camera selector panel.  Often, the right joystick was too sensitive, the left joystick was 'slow' or had low sensitivity/sensibility.


#1.  Will camera.speed affect both joysticks? 


#2.  If the right joystick is too fast/sensitive (compared to the left vj), do we/can we... use VJcamera.angularSensibility to slow it down?


#3.  Could JM's issue have been solved...like this...

var vjc = new VirtualJoysticksCamera(name, position, scene);vjc._leftjoystick.setJoystickSensibility(number);vjc._rightjoystick.setJoystickSensibility(number);

#4.  Should we maybe make ._leftjoystick and ._rightjoystick... public?  (remove underscore)


#5.  Does the joystick's _rotationSpeed get involved with our conversation here?


#6.  Do you think a feature would be possible... WHILE a joystick is active on-screen (being held on)... a user could tap + and - to adjust THAT joystick's _joystickSensibility?


(Sorry for so many questions.)



VJS Tracks in the Snow


Davrous, I see "ring tracks" when I drag one VJ into the other VJ's half-screen space.  For example, drag left VJ into right VJ space... it leaves tracks.  Same with the reverse action. 


#7.  Do you see that?  If so, do you think that needs to be fixed?


Thanks D!  (and any others who want to answer) 

Link to comment
Share on other sites

Hi Wingnut,


 The speed property will only affect the direction (left stick) and not the rotation. That's why I've also added 2 new functions getLeftJoystick & getRightJoystick:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Cameras/babylon.virtualJoysticksCamera.ts if you'd like to better tune the global sensibility.


 It's better to start t​uning using the speed property as we're computing the real speed based on the current FPS / deltatime to adjust the move.


 Still, if you'd like to adjust differently you can now do:


var vjc = new BABYLON.VirtualJoysticksCamera("vjc", Vector3.Zero(), scene);


 And thus have access to all properties linked to both joystick:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Tools/babylon.virtualJoystick.ts like also their color or Axis control.


 I known about the rendering bug on the middle. I need to work on it also, I was too lazy to fix it because I haven't found an easy & elegant solution up to now.​ ;)










Link to comment
Share on other sites

Hi Wingnut,


 I've spent a couple of hours in my plane for Orlando fixing the rendering issues with the rings when going over the middle of the screen. I've fixed also some bugs on the fire action (rendering part also).


 I've pushed it on the github.





Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...
  • 3 years later...

[email protected]

I am able to set right joystick speed with setJoystickSensibility. However this requires accessing a private property.

const camera = new BABYLON.VirtualJoysticksCamera('VJC', new BABYLON.Vector3(0, 1, -8), this._scene);

camera.attachControl(this._canvas, true);


I can't seem to find another way that doesn't require accessing any private property.


Edited by amoshydra
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...