Jump to content

Recommended Posts

Posted

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

1321908804-clip-23kb.jpg

 

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 ?

Working on LeaFAQ :)

Posted

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()

Working on LeaFAQ :)

Posted

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.

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Posted

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 :)

Working on LeaFAQ :)

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...