Notifications
Clear all

[Closed] camera nearrange and farrange

hi,
I’ve been trying to figure this one out for a good while now.
I want to create a plane where the nearrange and farrange on the selected camera.

I’m successfully creating the plane in the correct size, but I have trouble transforming it to where it should be.

What I would like, is to get help to translate where I create the vertex.
so that the vertex get’s created in the exact place where it should be.
(So that I do not have to move the plane afterwards).

How to run the code:
Create a camera, adjust the nearrange, run the script.

fn GetCamConeNearPoints =
  (
  	CurrCam = $
  	FarpointArr = #()
  	
  		MAXVP_DIST = 1.0f
  		dist = $.nearrange
  		if (dist > MAXVP_DIST)do
  		(
  			dist = MAXVP_DIST
  		)
  		ta = tan (0.5 * $.fov)
  		w = $.nearrange * ta
  		wtemp = $.nearrange
  		h = w / GetRendImageAspect() --1.333 --GetAspect();
  
  		vert_array = #()
  		face_array = #()
  		
  		vert_array[1] = [(w),(h),(-MAXVP_DIST)] 
  		vert_array[2] = [(-w),(h),(-MAXVP_DIST)]
  		vert_array[3] = [(-w),(-h),(-MAXVP_DIST)]
  		vert_array[4] = [(w),(-h),(-MAXVP_DIST)]
  		
  		face_array[1] = [1, 2, 3]
  		face_array[2] = [3, 4, 1]
  		
  		m = mesh vertices:vert_array faces:face_array
  		
  		nearrangePlane = m
  		nearrangePlane.parent = CurrCam
  		nearrangePlane.renderable = off
  		nearrangePlane.transform = CurrCam.transform
  		
  )		
  
  
  GetCamConeNearPoints()
1 Reply

got it to work by replacing these lines,

from:

		vert_array[1] = [(w),(h),(-MAXVP_DIST)] 
 		vert_array[2] = [(-w),(h),(-MAXVP_DIST)]
 		vert_array[3] = [(-w),(-h),(-MAXVP_DIST)]
 		vert_array[4] = [(w),(-h),(-MAXVP_DIST)]

to:

		vert_array[1] = [(w),(h),(-$.nearrange)] 
 		vert_array[2] = [(-w),(h),(-$.nearrange)]
 		vert_array[3] = [(-w),(-h),(-$.nearrange)]
 		vert_array[4] = [(w),(-h),(-$.nearrange)]