3dstreet icon indicating copy to clipboard operation
3dstreet copied to clipboard

manual vehicle control (rc joystick controller)

Open kfarr opened this issue 2 years ago β€’ 0 comments

as a user I'd like to be able to select and control vehicles in my scene with a magic "remote control" that works on desktop and eventually mobile, AR and VR modes.

existing projects - aframe joystick third person by @vincentfretin

  • https://aframe-joystick-third-person.glitch.me/
  • the important of the logic is in the aframe-joystick.js: https://glitch.com/edit/#!/aframe-joystick-third-person?path=aframe-joystick.js%3A77%3A0
  • in aframe-joystick.js cam var (#Box entity) moves the position of the target and `berk (#Berk entity) moves the rotation of the target entity being controlled by the joystick. Similar to the concept of a camera "rig" and the camera itself.

some code chores:

  • allow setting destination object instead of hardcoding berk and box
  • test switching object being controlled -- for example allow switching between sphere and cylinder in this demo

camera considerations:

  • ideal is "chase" camera that is not rigidly fixed to the target, but instead smooths with averaging of trailing positions toward a target or otherwise

DIY idea:

  • start with acceleration only for a v1. make an "acceleration" component. acceleration component to have 4 properties: "throttle" (number between -1 and 1, default 0), "speed" in m/s, "accelerationMax" number in m/s/s, "decelerationMin" number in m/s/s
  • v1: allow setting throttle. If 1 then accelerate at accelerationMax level on each tick.
  • v2: If throttle set to 0 then decelerate at decelerationMin level.
  • v3: If throttle set -1 accelerate at decelerationMax

Creative concept:

  • Muni vs. SFFD Engine drag race: find acceleration profile representative vehicles, research on beamng for existing vehicles (or just time them manually to get approximate estimate for a v1)

kfarr avatar Sep 06 '23 04:09 kfarr