开发者

Arrows on map with google maps API

开发者 https://www.devze.com 2023-03-05 01:14 出处:网络
I am using the google maps api for an android game that 开发者_StackOverflowincorporates the players movement in the real world. I have figured out how to make markers indicating where something would

I am using the google maps api for an android game that 开发者_StackOverflowincorporates the players movement in the real world. I have figured out how to make markers indicating where something would be on the map, but I would like to keep a fixed map zoom level and have off-screen markers show up as arrows on the screen.

Anyone know of a way inside of the map API to do this without having to explicitly figuring out the angle to the object and rotating an arrow icon to point in that direction.


I don't have experience of the Google API, but from a simple point of view if you know the current location and the marker location couldn't you just use some simple vector maths to calculate the heading and, therefore, the arrow heading?

i.e.

MarkerPosition - CurrentPosition = TargetVector
TargetVector.normalize()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号