Bug #76
in VR, avatar vertical position, height and arm movement messed up
0%
History
Updated by Josip Almasi over 2 years ago
Yeah that's it. Let me explain the code involved, it's all in WorldManager.
By default, we send up to 5 events per second, and create animations to interpolate in between. This is controlled by fps and createAnimations, so if you want to see your arm movements as they are, set fps=25 and createAnimations=false. I don't think these have anything to do with the bug though.
Sending side is trackChanges(), specifically
// track camera movements if ( this.camera.ellipsoid ) { var height = this.camera.globalPosition.y - this.camera.ellipsoid.y*2; if ( this.camera.ellipsoidOffset ) { height += this.camera.ellipsoidOffset.y; } this.checkChange("position", this.pos, new BABYLON.Vector3(this.camera.globalPosition.x, height, this.camera.globalPosition.z), changes); } else { this.checkChange("position", this.pos, this.camera.globalPosition, changes); } ... // track and transmit userHeight in VR if ( this.isChanged( this.userHeight, vrHelper.realWorldHeight(), this.resolution)) { this.userHeight = vrHelper.realWorldHeight(); changes.push({field: 'userHeight', value: this.userHeight}); }
The method later sends all changes in one packet, like VRSPACE.sendMyChanges(changes).
The purpose here is to calculate where your feet are.
Then on receiving side, when we load the avatar (loadAvatar method), we add a parent mesh, and use it to move the avatar around (changeAvatar method) like
if ( 'position' === field ) { if ( ! obj.translate ) { obj.translate = VRSPACEUI.createAnimation(node, "position", this.fps); } VRSPACEUI.updateAnimation(obj.translate, node.position, obj.position); ... } else if ( 'userHeight' === field ) { avatar.trackHeight(obj.userHeight);
If we're lucky, this is simply feet position being miscalculated on sending side. But I don't see anything obviously wrong with it.
More likely, it's mess with avatar positioning. Note that network events get routed to the same trackHeight() method that is a hack with hardcoded numeric values.
So what I'd do here is, comment out calls to trackHeight() and see what happens.
There's a chance we need to call Avatar.recompute() at some point. I hope not, as it may be computationally heavy. I'm not clear when it has to be called.
Updated by Josip Almasi over 1 year ago
- Status changed from New to Resolved
- Assignee changed from Vander Dias to Josip Almasi
WebXRCamera has ellipsoid and ellipsoidOffset values, but they do not make sense in the context. Real world height has to be used instead to find feet position.