Hey guys, I was testing a standalone occulus go on this demo I made a while back: Made with Needle
I still am testing it, but I was curious to know if we can connect a bluetooth controller to our device and use that to move around the scene, currently I own a red gear controller (https://www.amazon.in/Redgear-Pro-Wireless-Gamepad-Black/dp/B0756CLQWL) and was hoping this could extend to any xbox based or bluetooth controllers in general. Please do let me know what is possible for the same. Currently I am also in the process of trying to procure a Quest 3 by mid november.
Hi, it is possible with some javascript, yes. You can write a script to move the XR rig when in VR or to move your camera object or camera parent when not.
So basically I have to create a custom component to use use gamepads, does the current needle engine have the required dependencies exposed? Has there been any precedent cases or implementations on Needle I can refer to?
Okay, let me backtrack and go through these things properly.
I have been trying to explore ways of navigation around a VR scene, cause the default one feels mid. So I came across the idea to try connecting a game pad controller, which I want to just experiment with to see different ways people engage with the same scene then
Hey does this code from Chatgpt look coherent to you guys?
Will be testing it later tonight cause I’m in class right now but wanted to ask before your weekend starts
`
import { Behaviour } from ‘@needle-tools/engine’;
export class GamepadMovementRotation extends Behaviour {
private speed: number = 0.05; // Adjust the movement speed
private rotationSpeed: number = 0.03; // Adjust the rotation speed
private dir: number = 1;
lateUpdate() {
const gamepad = navigator.getGamepads()[0]; // Assuming the first connected gamepad
if (gamepad) {
// Deadzone to ignore small stick values
const movementDeadzone = 0.1;
const rotationDeadzone = 0.1;
const moveX = gamepad.axes[0];
const moveZ = -gamepad.axes[1]; // Invert for proper movement direction
const rotateY = gamepad.axes[2];
// Apply movement and rotation based on analog stick values
if (Math.abs(moveX) > movementDeadzone || Math.abs(moveZ) > movementDeadzone) {
this.move(moveX, moveZ);
}
if (Math.abs(rotateY) > rotationDeadzone) {
this.rotate(rotateY);
}
}
hey, hope you guys are having a good weekend, just wanted to ping that my component are acting weird on needle, the new components I make keep disappearing from the menu even after I save them or when they do appear and I add them, all the previously applied components disappear instead and they don’t show up. Been happening since yesterday
Okay update cause this has stumped me: Any new component I make and add removes ALL previously added components on all objects from view, web XR still works despite the component not being seen on where I added it, and essentially also stops me from adding any existing or new components to scene there after