Hi everyone!
I was wondering how i would implement custom teleporting behaviour for VR (i.e. curve laser raycast instead of a staight line, display an Arrow or circle of some sort at the chosen location, and only teleport once the stick is released).
So far, i tried poking around the engine > engine-components > WebXRController.ts Component and the runTeleport function. Would there be a better way to solve this? Or is this the only approach as of now?
I think what you’d have to do at the moment is to override the update and onUpdate methods of the XRController (or patch the static Create method and build your own controller there - then you get full control).
The WebXRController part is on the list to be modularized to make it simpler / possible to create custom behaviours but I dont think it will happen this year
sorry for digging this up, I’m currently trying to change something in WebXRController.ts but on build the export is still exporting an unchanged version. Is there a trick to get rid of old, cached files of the needle engine?
I’ve already tried disabling smart export and deleted the “dist” folder in the needle engine modules, that does not fix it.
Try clearing the vite cache (.vite folder in node_modules). But its not supported/recommended to change builtin code like that. Can you share what you changed?
I don’t think it can be patched, I want to have more control on where the player teleports when pointing towards a position. I’m using TeleportTargets Gameobject instead of the Raycast Hitpoint. Players are often bugging into geometry when teleporting to meshes above them (eg. a cube).
Also, I’ve commented out the miniaturemode because on double press, player can teleport on my Three.Water and I don’t know how to set the layer of a THREE.PlaneGeometry to Ignore Raycast
if (doTeleport) {
if (!this.didTeleport) {
const rc = this.raycast();
this.didTeleport = true;
if (rc && rc.length > 0) {
const hit = rc[0];
if (this.isValidTeleportTarget(hit.object)) {
const target = GameObject.getComponentInParent(hit.object, TeleportTarget);
if (target)
{
const point = target.gameObject.position;
setWorldPosition(rig, point);
}
}
}
}
}