Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Game Pad Component #12

Open
geyang opened this issue Apr 27, 2024 · 3 comments
Open

Fix Game Pad Component #12

geyang opened this issue Apr 27, 2024 · 3 comments

Comments

@geyang
Copy link
Contributor

geyang commented Apr 27, 2024

No description provided.

@marctuscher
Copy link

Hi @geyang,

I love vuer, I am currently building a teleop setup with it. And I realized the gamepad component doesn't work at this point (or I am using it in the wrong way :D).

Any updates on this? Would love to support, but it seems to be a client problem. I couldn't find the client code.

Cheers

@geyang
Copy link
Contributor Author

geyang commented Sep 2, 2024

Hi @marctuscher, here is the code for the Gamepad component : )

import { useGamepads } from 'react-gamepads';
import { ClientEvent, VuerProps } from '../../vuer/interfaces';
import { SocketContextType, useSocket } from '../../vuer/websocket';

export function Gamepad({ _key: key, children }: VuerProps) {
  const { sendMsg } = useSocket() as SocketContextType;
  useGamepads((gamepads) => {
    const { axes, buttons } = gamepads[0] as Gamepad;
    sendMsg({
      ts: Date.now(),
      etype: 'GAMEPADS',
      key,
      value: { axes, buttons: buttons.map((b) => b.value) },
    } as ClientEvent);
  });
  return <>{children}</>;
}

We currently do not have an example in the documentation, if you get this work feel free to add an example under docs/examples/0xxx_gamepad.md.

@uvikas
Copy link

uvikas commented Oct 28, 2024

Hi @geyang, I am also interested in the gamepad component and Quest3 joystick controller components. I am interested in adding a new etype for these new components on the client side, but I am unable to find the client code.

How do you suggest contributing these features? Are you able to release the full client code with instructions on how to build the client and test client locally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants