VeTaL Posted November 21, 2011 Share Posted November 21, 2011 Faced the similar problem as Function/Method - maybe i'm missing something again? 1) I have a type/class of walker, it has a field scanPivot Type TNodeWalker Extends TNode Global nodesWalkers:TList = CreateList() Field scanPivot:TEntity TNode is base class, it consists of mesh and nodes list... but i decided to create also additional list nodesWalkers to search walkers faster 2) In constructor, i create scanner node ListAddLast(nodesWalkers, Self) scanPivot = CreateCube() Local scanPos:TVec3 = EntityPosition(mesh) scanPos.y:+16 scanPos.z:-10 PositionEntity(scanPivot, scanPos) EntityParent(scanPivot, mesh) Actually, at this point everything works fine, as planned: bot running forward, scanner flys before bot Now, i'm calling from the main loop Repeat *** TNodeWalker.UpdateWalkersList() *** This function is declared inside TNodeWalker and it is running throguh all walkers and call their UpdateWalkers() Function UpdateWalkersList() For n:TNodeWalker = EachIn nodesWalkers n.UpdateWalkers() Next EndFunction in UpdateWalkers() i have: Method UpdateWalkers() pickFrom = EntityPosition(scanPivot) DebugLog "scanPivot pos: " + pickFrom.x + " " + pickFrom.y + " " + pickFrom.z EndMethod The problem is that debugger shows DebugLog:scanPivot pos: 0.000000000 -5.00000000 -10.0000000 DebugLog:scanPivot pos: 0.000000000 -5.00000000 -10.0000000 DebugLog:scanPivot pos: 0.000000000 -5.00000000 -10.0000000 DebugLog:scanPivot pos: 0.000000000 -5.00000000 -10.0000000 DebugLog:scanPivot pos: 0.000000000 -5.00000000 -10.0000000 DebugLog:scanPivot pos: 0.000000000 -5.00000000 -10.0000000 DebugLog:scanPivot pos: 0.000000000 -5.00000000 -10.0000000 So, looking like method cannot access class field ? Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted November 21, 2011 Author Share Posted November 21, 2011 Okay, throwing out TNodeWalker.UpdateWalkersList() Trying to call this one returns compilation error Repeat *** For n:TNodeWalker = EachIn nodesWalkers n.UpdateWalkers() Next *** This compiles, but output is still wrong Repeat *** For n:TNodeWalker = EachIn TNodeWalker.nodesWalkers n.UpdateWalkers() Next *** PS: nodesWalkers is global list Type TNodeWalker Extends TNode Global nodesWalkers:TList = CreateList() Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
VeTaL Posted November 21, 2011 Author Share Posted November 21, 2011 Got an idea that maybe inside a class field = private global = public nope, still the same ugly output results Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
klepto2 Posted November 21, 2011 Share Posted November 21, 2011 It looks like you mixed global and local positions. As the scan pivot is child of the bot you should use: EntityPosition(scanPivot,true) for receiving the global position. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
VeTaL Posted November 21, 2011 Author Share Posted November 21, 2011 Aaaaaand... First prize (a large cookie) comes to Klepto2 for right answer: pickFrom = EntityPosition(scanPivot,true) Second prize (glass of beer) comes to Metatron for his time Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.