Digits
10-10-01, 10:32 AM
Heh, sorry to keep pestering you with my little problems :) I am trying to figure out how to convert the Z Postitioning of a light to object cords. The XY cords were pretty easy. This routine will convert an objects XY postion into Light cords and move the light position to correspond
<BLOCKQUOTE>quote:</font><HR>
[RoutineDef,FollowObjectwithLight,
[VarSet,dWidth,DOCUMENT:MODIFIERS:WIDTH]
[VarSet,dHeight,DOCUMENT:MODIFIERS:HEIGHT]
[VarSet,dMidX,dWidth/2]
[VarSet,dMidY,dHeight/2]
[VarDef,opic,0]
[VarDef,lx,0]
[VarDef,ly,0]
[VarDef,dptr,0]
//xdata and ydata is array of the objects xy position indexed by dptr
[if,[isenabled,light:modifiers:Placement],
[VarSet,dptr,(opic*50)+Frame]
[VarSet,opic,[IGet,zscript:Follow]]
[VarSet,lx,(((xdata(dptr)-dmidx)*100)/dwidth)/100]
[VarSet,ly,(((ydata(dptr)-dmidy)*100)/dheight)/100]
[ISet,Light:Modifiers:Placement:Locallightxpos,lx]
[ISet,Light:Modifiers:Placement:Locallightypos,ly]
]
]
<HR></BLOCKQUOTE>
The X & Y is referenced to the Doc Width and Height so it is easy to figure out. But I have been unable to figure out what reference the Z axis uses. I have made tests in excel sampling the result of different positions in z but I still can't seem to get it. It seems that the clipping plane changes in regards to Doc width and height but that doesn't seem to help me either. Anyhoo, you probably have the answer I hope! Thanks!
<BLOCKQUOTE>quote:</font><HR>
[RoutineDef,FollowObjectwithLight,
[VarSet,dWidth,DOCUMENT:MODIFIERS:WIDTH]
[VarSet,dHeight,DOCUMENT:MODIFIERS:HEIGHT]
[VarSet,dMidX,dWidth/2]
[VarSet,dMidY,dHeight/2]
[VarDef,opic,0]
[VarDef,lx,0]
[VarDef,ly,0]
[VarDef,dptr,0]
//xdata and ydata is array of the objects xy position indexed by dptr
[if,[isenabled,light:modifiers:Placement],
[VarSet,dptr,(opic*50)+Frame]
[VarSet,opic,[IGet,zscript:Follow]]
[VarSet,lx,(((xdata(dptr)-dmidx)*100)/dwidth)/100]
[VarSet,ly,(((ydata(dptr)-dmidy)*100)/dheight)/100]
[ISet,Light:Modifiers:Placement:Locallightxpos,lx]
[ISet,Light:Modifiers:Placement:Locallightypos,ly]
]
]
<HR></BLOCKQUOTE>
The X & Y is referenced to the Doc Width and Height so it is easy to figure out. But I have been unable to figure out what reference the Z axis uses. I have made tests in excel sampling the result of different positions in z but I still can't seem to get it. It seems that the clipping plane changes in regards to Doc width and height but that doesn't seem to help me either. Anyhoo, you probably have the answer I hope! Thanks!