Notifications
Clear all

[Closed] scripted camera – adding visual elements

hello,

I want to add visual elements to my scripted camera, for example:
I want to add a simple squere that will show the camera view 100 units away in
the camera z axis.

I looked at the example that comes with the maxscript reference, but if I implement
the getDisplayMesh function I can only get my squere to show and the
rest of the original camera icon (camera + viewing cone etc.) is gone.

I just want to add elements without deleting the ordinary camera visual
elements.

any help would be great.

thanks.
Ofer.

6 Replies

you can manipulate the mesh before the meshObj.mesh sentence in that example.
for example, you can add a new mesh to the original with:

newmesh =  createInstance box ...
...
mesh = mesh + newmesh
...
meshObj.mesh = mesh

thanks, but it didnt work.

I tryed for some time doing what you wrote but no metter what, I get an error that
Max cant recognize “mesh”.

If I’m doing somthing wrong could you please show me a code that adds a box
to the existing camera icons.

Thank you for your time.

Please, post what you have to check it.
Best.

hey,
this is what I got, I didnt got anything that worked so I dont have anything saved
but is what I tryed to do:


plugin Camera CamTest_DisplayMesh
name:"CamTest" 
classID:#(0x47db14ff, 0x4e9b5f90) 
category:"Standard" 
extends:FreeCamera 
( 
local lastR1, lastR2, meshObj
 
 
on getDisplayMesh do 
(
if (meshObj == undefined) do
(
Box1 = createInstance box
mesh = mesh + Box1.mesh
 
)
 
meshObj.mesh =mesh
)--end on getDisplayMesh
 
tool create 
( 
on mousePoint click do (nodeTM.translation = gridPoint;#stop )
)--end tool
 
)--end plugin
 

just want to get the basic of adding visual elements to my cam before I move on with
scripting my camera.

Ok. I didnt have max with me on the last post. so I have many basic scripting errors.

what I’m trying to get is a the good old camera in my viewport (cone etc.)
plus a simple box…

can anyone help?

I think you’ll have to generate the entire meshes yourself – ‘mesh’ is empty when you get the display mesh.

Depending on what you’re trying to do, perhaps it’d be easier to go a different route? e.g. letting a custom attribute block or a helper object or so govern a regular camera and ‘add’ a mesh to that by simply creating a new object?

Not as clean, but should be much simpler.