im encountered major problem
quest: http://wowhead.com/quest=39801
its a stormheim first scenario. you need to do few stages on different ships. last ship its a flying vehicle. while on this ship character marked as ObjectManager.Me.PlayerUsingVehicle = true
and main problem here that all WoWGameObjects on this ship have some kine of local coordinates, but all WoWUnit have global coordinates
i found main root object its a http://www.wowhead.com/object=241630/the-skyfire
but all local coordinates rotated according to root object.
ObjectManager.GetNearestWoWGameObject(ObjectManager.GetWoWGameObjectByEntry return very wierd object.
i made custom search for http://www.wowhead.com/object=243244/place-volatile-flare
WoWGameObject Fire() { var skyfire = Skyfire(); if (skyfire == null) return null; var fires = ObjectManager.GetWoWGameObjectByEntry(243244); var i = 0; foreach (var f in fires) { var l = f.Position; var g = SkyfirePosition(l); Logging.Write(" FIRE: " + f.Name + " local=" + l + " global=" + g + " dist=" + ObjectManager.Me.Position.DistanceTo(g) + " distZ=" + ObjectManager.Me.Position.DistanceZ(g)); i += 1; } Thread.Sleep(60 * 1000); return null; var fire = fires.OrderBy(f => (skyfire.Position + f.Position).DistanceTo(ObjectManager.Me.Position)).FirstOrDefault(); if (fire != null && fire.IsValid) // && fire.GetDistance < 10) { return fire; } return null; } WoWGameObject Skyfire() { var skyfire = Questing.FindObject(241630); if (skyfire != null && skyfire.IsValid) { return skyfire; } return null; } Vector3 SkyfirePosition(Vector3 position) { var skyfire = Skyfire(); if (skyfire == null) return position; return skyfire.Position + position; }
this show me in log this:
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=-42,00801 ; 20,33346 ; -5,301661 ; "None" global=5029,452 ; 3161,753 ; 341,6329 ; "None" dist=65,96511 distZ=0,1261902
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=4,292825 ; 21,32118 ; 9,675672 ; "None" global=5075,753 ; 3162,741 ; 356,6102 ; "None" dist=26,25074 distZ=14,85114
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=11,65337 ; 22,25098 ; -5,199101 ; "None" global=5083,113 ; 3163,671 ; 341,7355 ; "None" dist=16,22754 distZ=0,02362061
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=30,94354 ; 13,90275 ; 9,602867 ; "None" global=5102,403 ; 3155,323 ; 356,5374 ; "None" dist=16,90774 distZ=14,77835
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=-11,01605 ; 26,19757 ; -5,261852 ; "None" global=5060,444 ; 3167,617 ; 341,6727 ; "None" dist=37,54287 distZ=0,08636475
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=43,98859 ; 11,11288 ; 9,266898 ; "None" global=5115,449 ; 3152,533 ; 356,2015 ; "None" dist=25,24469 distZ=14,44238
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=31,18011 ; -12,76628 ; 9,604154 ; "None" global=5102,64 ; 3128,654 ; 356,5387 ; "None" dist=29,02637 distZ=14,77963
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=1,801268 ; -22,6643 ; 9,656803 ; "None" global=5073,261 ; 3118,756 ; 356,5914 ; "None" dist=42,54895 distZ=14,83228
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=12,40635 ; -22,39768 ; -5,23788 ; "None" global=5083,866 ; 3119,022 ; 341,6967 ; "None" dist=35,06266 distZ=0,06240845
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=47,24242 ; -11,90643 ; 9,221651 ; "None" global=5118,702 ; 3129,513 ; 356,1562 ; "None" dist=36,09694 distZ=14,39713
02:31:04 - FIRE: Разместить нестабильную взрывчатую смесь local=-29,31074 ; -24,93864 ; -5,243851 ; "None" global=5042,149 ; 3116,481 ; 341,6907 ; "None" dist=63,66412 distZ=0,06838989
but i stay right on needed gameobject http://www.wowhead.com/object=243244/place-volatile-flare
distance for one of http://www.wowhead.com/object=243244/place-volatile-flare must be < 5
i assume there is some kind parent rotation applied to local gameobjects positions
i think wrobot should add support for converting local position to global position according to parent rotation
something like
Vector3 WoWGameObject.PositionGlobal {get;} // if no parent return Position
ps. i have no idea how i can find global position. maybe i can calculate somehow ?
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now