-
Notifications
You must be signed in to change notification settings - Fork 925
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
[feature request] SimulateLatitude, SimulateLongitude work even if gps is turned on #500
Comments
@marcusx2 just getting back to you on this one. The gps-new-camera component contains this logic:
So you can see that the 'real' GPS is only started if simulateLatitude and simulateLongitude are 0 (or not specified, as 0 is the default value). Can you let me know exactly what you try which produces this behaviour, so I can reproduce? Do you dynamically set simulateLatitude and simulateLongitude later? The code does not yet cover this possibility, but is an easy fix. Thanks. |
Then it's not working as expected. It gets the gps values even if simulateLatitude and simulateLongitude are different than 0. I can only get the simulate values to work in incognito mode for some reason. Code is very simple
Also, good to know that setting the values dynamically don't work yet. Should I create an issue for this as well so that we can set the simulate values dynamically? |
Not sure in that case, let me check your code. Best keep it in this issue as it's related. |
(setting the values dynamically does work in most cases, by the way, as long as you set an initial |
I tried your example and it works for me (this was on both Firefox and Chrome), and I accepted the "Allow site to use location?" prompt. The lat and lon I use is not my real location. I made some tweaks to use a valid lat/lon (as a latitude of 100 is invalid), and also replaced
If I try this, the position is what I would expect in Spherical Mercator coordinates. Try this, you should get an |
It only works on incognito mode here, if I don't allow location services. I tried on chrome for Windows and chrome for Android, both the same thing :(. On second thought, it's probably not about the incognito mode itself, but the fact that on non-incognito location services is already running and I'd have to clear the cache to block it. |
Strange. Try completely clearing your cache. All I can suggest is that others (@kalwalt ?) try out your example to see if it works for them. There is one issue that I can see, which I mentioned above, namely that if |
I tested on other browsers as well. This only works if location services is turned off. Maybe it has something to do with newer devices. I'm using an old Samsung S8, and windows 8.1. |
I will have to draw a blank on this, I am afraid - though if others experience the same problem, please do post here. |
The only other thing I suggest you do is to check out the source code for AR.js, and then, using |
It's fine, this is not a huge deal. I'm done debugging this problem. Maybe other people with the same problem can chime in later with more insight. |
@nickw1 I experience this on literally every device I've tried it on, Poco F5, 10th gen iPad, Samsung galaxy. No idea how this is broken if the logic is as simple as:
But it clearly is. I'll try your advice to debug this when I get around to it, but as things currently are I can't enable location services anyway as doing so disables dragging to calibrate true north. |
@Platform-Group could you provide the code you're using to test this? As you can see above I am at a loss to explain it but it's conceivable something about your test code allows the problem to be diagnosed. Thanks. |
@nickw1 sure, I've had this issue with the most basic of examples though. I assumed it was normal so I've just been doing a lot of testing with my GPS off.
|
So just to be sure I wasn't hallucinating this behaviour, I gave my phone both camera and gyro permissions. But left the location services permission request box on screen. Pointed my camera at an entity from the simulated location, then allowed location services, the entity vanishes and as I look around I'm only left with the entities which are near my real location. |
OK let me try your example when I have a moment. It certainly "shouldn't" start location if the simulated lat and lon are not zero, but let me give it a go. |
I did some debugging @nickw1 the play function is receiving this.data.simulatedLatitude and this.data.simulatedLongitude as zero despite that not being what was set on the a-camera entity. However the update function recieves the correct value.
Output: update says sim lat is 51.514438902042905 |
@nickw1 @marcusx2 I've got a fix for you:
The issue is that update was setting simulated lat and long to 0, and update runs before play for some reason. So I just added in the fakeGpsStarted boolean to handle that instead of setting simulated lat and long to 0. |
@Platform-Group many thanks for your fix, I will incorporate it into the code base. I am puzzled though. https://aframe.io/docs/1.4.0/core/component.html#play and certainly after Furthermore It's not clear to me, therefore, why the |
Well because update was called first, that was setting lat and long to 0 and overwriting the values specified in the html. So then play comes around and starts the gps because lat and long is 0 by then |
@Platform-Group ah ok thanks. Oops... I forgot that I'm not sure whether resetting |
@nickw1 from what I saw it was simply to prevent fakeGps from starting on every update call, so that's why I added the new bool in |
@Platform-Group that makes sense. Do you want to submit a PR? Your fix looks sensible to me so I should be able to incorporate it into the Remember to submit the PR against |
@nickw1 I've found that my changes don't really work, the constraints as they are seem to actually change the cameras native resolution which is pretty screwed. I'm now leaving out the ideal width and height values. Which I believe is correct as it isn't asserting a resolution that is completely screwed. But I don't think I can really trust that either as I'm having weird issues with it on my device with multiple possible video feeds. I'll be working on it more though so maybe I'll have something better soon. Oh yeah it also doesn't seem to work quite right sometimes when the device is vertical vs horizontal. Also you'll run into browser compatibility issues as apparently the format of that constraints object is different on different browsers depending on which they are and how old they are. I've already found that I can break the camera feed by putting in an ideal resolution that's too high. |
@Platform-Group I mean a pull request in which you fork the repo, make the changes and then submit a pull request to If not I will make your changes but it's as well learning how to make pull requests if you don't know how to do so already. Thanks! |
This relates to issue #498? Thanks for your work on this, once you've fixed it more reliably again I'd recommend you submit a pull request. |
Yeah I know how to make PRs, I just don't think my work so far is a solution or should even be merged. I've actually reverted it locally now in favour of using an iframe to get around broken embed functionality instead. |
@Platform-Group I have implemented (a slightly different version of) your fix to #500. See PR #560. I actually don't think the flag is needed anyway, it makes more sense to me to allow these properties to be set multiple times. But not fixing this now as it might break things for some people. |
For some reason for the previous few comments of mine I thought we were talking about the camera resolution/ratio issue. But anyway that flag wasn't about setting properties multiple times, it was to fix the original issue described in this thread which I described the fix for further up. |
I think that if the simulate values are not 0, they should be used regardless if the gps is working or not. After all, why the extra step of having to turn off the GPS, if the simulate value already tells you if it should be used if it's different than 0? This seems unnecessary. There's also the annoyance of having to clear the cache to be asked for gps permission again, or having to use incognito mode.
Is there a reason the GPS must be turned off to use the simulate values even they are already different than 0, and therefore I am saying that I want to use the simulate values regardless if the gps is on or off?
Maybe another property like 'useSimulateValuesEvenIfGpsIsOn'(default false to avoid breaking existing projects) could be created? Let me know what you think.
The text was updated successfully, but these errors were encountered: