# Vray Camera Creation Via Maxscript

**URL:** <https://forums.chaos.com/t/vray-camera-creation-via-maxscript/53088>\
**Category:** Issues\
**Created:** [March 17, 2015, 11:55am UTC](https://forums.chaos.com/t/vray-camera-creation-via-maxscript/53088 "2015-03-17T11:55:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nexus\_Productions](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/nexus_productions/32/8769_2.png) [@Nexus\_Productions](https://forums.chaos.com/u/Nexus_Productions)\
**Post date:** [March 17, 2015, 11:55am UTC](https://forums.chaos.com/t/vray-camera-creation-via-maxscript/53088/1 "2015-03-17T11:55:40Z")

</div>

Hi,

When I create a vray camera via MXS, it does not create a target (even with targeted:on) Creating with targeted:off, then toggling this state has the required effect.

```auto
v = VRayPhysicalCamera isSelected:true target_distance:200 targeted:on
[COLOR="#0000FF"]$VRayPhysicalCamera:VRayCam001 @ [0.000000,0.000000,0.000000][/COLOR]
v.target
[COLOR="#0000FF"]undefined[/COLOR]

```

```auto
v = VRayPhysicalCamera isSelected:true target_distance:200 targeted:off
[COLOR="#0000FF"]$VRayPhysicalCamera:VRayCam002 @ [0.000000,0.000000,0.000000][/COLOR]
v.targeted = on
[COLOR="#0000FF"]true[/COLOR]
v.target
[COLOR="#0000FF"]$Target:VRayCam002.Target @ [0.000000,0.000000,-200.000000][/COLOR]

```

Can anyone else clarify this behaviour, or does something else need to passed into the constructor?

Thanks,

Pete

Vray 3.10.01

---

<div class="post-metadata">

**Author:** ![Dave\_Wortley](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@Dave\_Wortley](https://forums.chaos.com/u/Dave_Wortley)\
**Post date:** [March 17, 2015, 3:37pm UTC](https://forums.chaos.com/t/vray-camera-creation-via-maxscript/53088/2 "2015-03-17T15:37:59Z")

</div>

Hi Pete,

I think off the top of my head it needs to be v = VrayPhysicalCamera target:(TargetObject()) targeted:on  
or something along those lines.

Dave

---

<div class="post-metadata">

**Author:** ![Nexus\_Productions](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/nexus_productions/32/8769_2.png) [@Nexus\_Productions](https://forums.chaos.com/u/Nexus_Productions)\
**Post date:** [March 19, 2015, 2:47pm UTC](https://forums.chaos.com/t/vray-camera-creation-via-maxscript/53088/3 "2015-03-19T14:47:45Z")

</div>

Oh yes, That’s true for anything that uses a target isn’t it

```auto
v = VrayPhysicalCamera target:(TargetObject()) targeted:on name:"Bumholes"
v.target.name = v.name + ".Target"

```

Cheers Dave
