Getting DISTANCE from objects array

Why it's dosent work ???
---------------------------------------------------
varCamera=cameras[1]
varElenments=geometry as array
varIniDist=#()
-- varTape=undefined
ter=undefined
for i = 1 to varElenments.count do
(
pName="Tape"+"_"+varElenments[i].name as string

varTape=tape pos: varCamera.pos target:(targetObject pos:varElenments[i].pos) name:pName
-- ishidden:on
append varIniDist varTape

)

for i = 1 to varElenments.count do
(

ter=distance varIniDist[i].pos varCamera.pos
distance CarrentCam.pos CarrentObj.pos
print ter
)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

I don't know what are you trying to achieve, but to get the distance from camera to object you can use this:

(
	varCamera=cameras[1]
	varElenments=geometry as array
	for i = 1 to varElenments.count do
	(
 
		ter= distance varElenments[i].pos varCamera.pos
		print ter
	)
)

In your code CarrentCam and CarrentObj are not defined, so you get an error.
By the way, put the code in ...code here....

Any's picture

.....

Sorry, yesterday I overdone....
Thank you for your attention.....

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.