Notifications
Clear all

[Closed] Target Distance Undefined?

I’ll make this simple to understand:

  1. Create a “Free Camera”
  2. Open MaxScript Listener
  3. In the Modify tab of max, change your target distance to another number (example 6.506″).

Your MaxScript Listener will display in the pink zone:
$.targetDistance = 6.50628

But if you type:
$.targetDistance

You will recieve:
undefined

My question is, why does targetDistance respond with undefined? If I type in other properties like .fov, I get the correct response of 45.0. But .targetDistance is undefined, why??

4 Replies

a free cam don’t have any target

edit: if u want a target cam, u should use this

[b][b]targetCamera

[/b][/b]

That’s not to say that a freeCamera doesn’t have a target distance property; in fact, manipulating that value in a freeCamera allows you to control the reach of the view frustrum in the viewports, for example – and the Depth of Field by default uses the target distance as well.

Which doesn’t answer the original question, but…


$
$Free_Camera:Camera01 @ [37.269371,0.000001,-26.199263]
$.targetDistance
undefined
$.targetDistance = 10
10 [color=Green]-- but it's not actually set to 10
[/color]$.target_distance -- subAnim value accessor
96.0 [color=Green]-- see?
[/color]$.target_distance = 10
10
$.target_distance
10.0 -- now it is

No idea why .targetDistance returns undefined and can’t be set, though; I do suspect it’s related to the freeCamera vs targetCamera thing (as you can’t particularly set it when you are using an actual target), but that’s just a wild guess.

DIRECT QUOTE FROM THE HELP:

[left][b][b]NOTE:[/b][/b]

[/left]
[left]In 3ds Max, all node-level properties are searched before base-object-level properties. If a base-object property has the same name as a node-level property, you need to search in the base object for the base object property.
[/left]
[left]This affects the following properties of freeCamera:
[/left]
[left]
[/left]
[left]<freeCamera>.baseObject.targetDistance
[/left]
[left]Get/Set the target distance of the Free Camera.
[/left]
[left]Every node in 3ds Max has a node property .targetDistance which contains the distance to an eventual target the node is looking at using a LookAt controller. (you can assign a node to the .lookAt property and the controller will be assigned automatically).
[/left]
[left]Thus, a Free Camera has such a node property but it is set to undefined, and a baseobject property with the same name which contains the actual target distance value shown in the User Interface. If the Free Camera gets converted to a Target camera, the node-level property will be displayed in the User Interface and should be accessed via MAXScript.
[/left]

well, that explains that :>
/me tells self to rtfm