I'm having trouble calculating the angle towards a waypoint..
I can get my location coordinates (Lat1, Long1), and the waypoint coordinates (Lat2, Long2).
I can also use the orientation sensor to point a sprite north..
But how in the world will I make it point towards my waypoint?
--
you can calculate the bearing according to that formula Movable Type Scripts
I can get my location coordinates (Lat1, Long1), and the waypoint coordinates (Lat2, Long2).
I can also use the orientation sensor to point a sprite north..
But how in the world will I make it point towards my waypoint?
--
you can calculate the bearing according to that formula Movable Type Scripts
then just use the following snippet
--
Thanx Taifun, for the snippet..
I actually found that page you suggest, and startet to make it into code - but the x-part of the atan2-argument (the last), I don't know how to write with blocks..
This part eludes me...
cos(lat1)*sin(lat2) − sin(lat1)*cos(lat2)*cos(long2-long1)
- and can I use the coordinates as provided by app-inventor, or do they have to be converted somehow?
I actually found that page you suggest, and startet to make it into code - but the x-part of the atan2-argument (the last), I don't know how to write with blocks..
Bearing = | atan2( | sin(long2-long1)*cos(lat2),cos(lat1)*sin(lat2) − sin(lat1)*cos(lat2)*cos(long2-long1)) |
This part eludes me...
cos(lat1)*sin(lat2) − sin(lat1)*cos(lat2)*cos(long2-long1)
- and can I use the coordinates as provided by app-inventor, or do they have to be converted somehow?
--
all the blocks you need are there, see the math blocks http://appinventor.mit.edu/explore/ai2/support/blocks/math.html
and you can use the coordinates as provided by AI
and you can use the coordinates as provided by AI
--
I guess it just took a little patience...
This is what I ended up with, it seems to work - I hope someone else can benefit, from Taifun's help and my findings..
--
Do you mind sharing a screenshot of the blocks editor page ... I am trying to put together an app that points towards a particular building.
--
Do you mind sharing a screenshot of the blocks editor page ... I am trying to put together an app that points towards a particular building.
Your seem similar and your help will be appreciated. Trying to put this together and struggling to make sense at the moment ...
--
I saw this in the thread ... but where does this slot in?
--
here https://lh5.googleusercontent.com/-DgHPb5H9vvA/UCRE8KTo1-I/AAAAAAAAAck/I26Em-ZCZm4/s1600/bearing.JPG
just replace intBearing by Direction from the Engberg example
just replace intBearing by Direction from the Engberg example
--
is this still relavant to AI2? i dont seem to be able to find the blocks. sorry if its obvious.
--
you will have to manually translate Engberg's solution form App Inventor Classic to App Inventor 2
btw. this forum will be deactivated today, see also Hal's announcement here https://groups.google.com/forum/#!topic/programming-with-app-inventor/yJhjhbiwYVA
it there are still questions, please follow up in the other forum https://groups.google.com/forum/#!forum/mitappinventortest
--
--
댓글 없음:
댓글 쓰기