<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: reflect vector on surface - like a lazer! in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824656#M2868</link>
    <description>&lt;P&gt;&lt;EM&gt;Could I swap out the light ray source to be the sun light object instead of 'sunOrigin'?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you asking about getting the location of the sun for a Sun Position object? If so it may require a calculation using the transform of the Sun Position Compass along with the distance to the sun, the azimuth&amp;nbsp;and the altitude.&amp;nbsp; I think this should be straight forward.&amp;nbsp; Typically when you link a point to another object you need to multiply the point's local location times the transform of the parent (the sun).&amp;nbsp; But, the transform of a Sun Positioner is the location of the its compass not the sun so that's why I think you need to use other parameters to determine the sun location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Also, how do you bring up the 'script controller' window you have in your screenshot?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select Point001, then go to the Motion tab and double-click Position:Position Script under Transform:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are new to scripts for controllers and using vector and matrix operations you might find a couple of my youtube tutorials of help.&amp;nbsp; For example: &lt;A href="https://youtu.be/MS1IVo1QB78" target="_blank" rel="noopener"&gt;Rigging a Hexapod&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Mar 2023 00:58:06 GMT</pubDate>
    <dc:creator>leeminardi</dc:creator>
    <dc:date>2023-03-16T00:58:06Z</dc:date>
    <item>
      <title>reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11817185#M2860</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;I'm just getting started with MAXscript.&lt;/P&gt;&lt;P&gt;I want to reflect a line about a surface normal to create a new line to simulate light bouncing. The line is defined by the location of a point helper named lineOrigin01. The end of the line is at the center of an editable mesh object named reflectSurface01. I want to create a new line that is 100m long at the reflected direction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the best I could come up with, with chatGPT helping (or not helping but helping me learn). Get the objects, get the normal vector, reflect function, draw the line. If anyone has ANY tips or ideas they would be gladly received!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Define the start point of the line as the location of sunORIGIN object&lt;BR /&gt;startPoint = sunORIGIN.pos&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Define the surface object to reflect off of as reflectSURFACE&lt;BR /&gt;surfaceObj = $reflectSURFACE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Get the center point of the surface object&lt;BR /&gt;surfaceCenter = (surfaceObj.max + surfaceObj.min) * 0.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Get the normal vector of the surface object&lt;BR /&gt;surfaceNormal = normalize((surfaceObj.normal * surfaceObj.transform) as vector3)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Calculate the end point of the line using the reflect() function&lt;BR /&gt;endPoint = reflect(startPoint - surfaceCenter, surfaceNormal) + surfaceCenter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-- Create the line object with a length of 100 units&lt;BR /&gt;lineObj = createLine start:endPoint end:(endPoint + surfaceNormal * 100.0)&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 09:29:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11817185#M2860</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-13T09:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11817445#M2861</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3446815"&gt;@CoreyMurray&lt;/a&gt;&amp;nbsp; написал (-а):&lt;BR /&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;I'm just getting started with MAXscript.&lt;/P&gt;...&lt;BR /&gt;&lt;P&gt;Below is the best I could come up with, with chatGPT helping (or not helping but helping me learn). Get the objects, get the normal vector, reflect function, draw the line. If anyone has ANY tips or ideas they would be gladly received!&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;It is actually preventing you from learning anything since it doesn't even know the correct maxscript syntax. Reading maxscript reference is a way better method to learn scripting or if you prefer video there's a great maxscript 101 series on vimeo.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 11:32:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11817445#M2861</guid>
      <dc:creator>Serejah</dc:creator>
      <dc:date>2023-03-13T11:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11818914#M2862</link>
      <description>&lt;P&gt;It is far from perfect, and can mix up syntax yes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But for simple syntax and for explaining things I find it quite useful - in addition to reference and tutorials.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But thanks for you opinion there, i guess.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Did you have any suggestions on the 'reflect vector' topic and how i might achieve this?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 21:48:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11818914#M2862</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-13T21:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11818992#M2863</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3446815"&gt;@CoreyMurray&lt;/a&gt;&amp;nbsp; написал (-а):&lt;BR /&gt;&lt;P&gt;It is far from perfect, and can mix up syntax yes.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;Did you have any suggestions on the 'reflect vector' topic and how i might achieve this?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I prefer the old school way and simply google anything I don't know or forgot&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=7yws8RRDYRA" target="_blank"&gt;https://www.youtube.com/watch?v=7yws8RRDYRA&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Mar 2023 22:32:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11818992#M2863</guid>
      <dc:creator>Serejah</dc:creator>
      <dc:date>2023-03-13T22:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11823838#M2864</link>
      <description>&lt;P&gt;&lt;A href="https://www.amazon.com/Geometric-Computer-Graphics-Morgan-Kaufmann/dp/1558605940" target="_blank" rel="noopener"&gt;https://www.amazon.com/Geometric-Computer-Graphics-Morgan-Kaufmann/dp/1558605940&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 18:01:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11823838#M2864</guid>
      <dc:creator>istan</dc:creator>
      <dc:date>2023-03-15T18:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824192#M2865</link>
      <description>&lt;P&gt;In the attached file I used the equation&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9662356"&gt;@Serejah&lt;/a&gt;&amp;nbsp;referenced for defining the reflected vector.&amp;nbsp; I used it to locate a point 10 units from the surface. A line with a Spline IK Control modifier is use to show the reflected "ray". Note, the variable surface is the transform of reflectSurface.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="leeminardi_0-1678911817423.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1189214iC2DF04577726AAD0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="leeminardi_0-1678911817423.png" alt="leeminardi_0-1678911817423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 20:27:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824192#M2865</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-15T20:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824239#M2866</link>
      <description>Hi leeminardi&lt;BR /&gt;Thank you very much for your response and the scene file. It never occurred to me to use a control modifier, but seems like a great idea. I will take a look at the scene and educate myself on controllers.&lt;BR /&gt;Thanks again for your help&lt;BR /&gt;Corey&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Mar 2023 20:46:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824239#M2866</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-15T20:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824364#M2867</link>
      <description>&lt;P&gt;Hi again&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/822616" target="_self"&gt;&lt;SPAN class=""&gt;leeminardi&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That looks like a really tidy solution! When i rotate the surface, the ray reflects based on the normal of the surface, and when I move the 'sunOrigin' helper it also controls the incident angle - so cool!&lt;BR /&gt;&lt;BR /&gt;i guess the last thing i want to do is link the 'sunOrigin' helper to the position of an actual sun in a daylight system, so the the ray origin is always the same as the sun. I tried linking 'sunOrigin' to the daylight system and sun, but it loses connection/link to the reflected ray.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CoreyMurray_0-1678918430558.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1189263iCC97AE33DE651EAA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CoreyMurray_0-1678918430558.png" alt="CoreyMurray_0-1678918430558.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Could I swap out the light ray source to be the sun light object instead of 'sunOrigin'?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Also, how do you bring up the 'script controller' window you have in your screenshot?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry if i am missing something, still trying to wrap my head around this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks really appreciate your help on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Corey&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2023 22:14:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824364#M2867</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-15T22:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824656#M2868</link>
      <description>&lt;P&gt;&lt;EM&gt;Could I swap out the light ray source to be the sun light object instead of 'sunOrigin'?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you asking about getting the location of the sun for a Sun Position object? If so it may require a calculation using the transform of the Sun Position Compass along with the distance to the sun, the azimuth&amp;nbsp;and the altitude.&amp;nbsp; I think this should be straight forward.&amp;nbsp; Typically when you link a point to another object you need to multiply the point's local location times the transform of the parent (the sun).&amp;nbsp; But, the transform of a Sun Positioner is the location of the its compass not the sun so that's why I think you need to use other parameters to determine the sun location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Also, how do you bring up the 'script controller' window you have in your screenshot?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select Point001, then go to the Motion tab and double-click Position:Position Script under Transform:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you are new to scripts for controllers and using vector and matrix operations you might find a couple of my youtube tutorials of help.&amp;nbsp; For example: &lt;A href="https://youtu.be/MS1IVo1QB78" target="_blank" rel="noopener"&gt;Rigging a Hexapod&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 00:58:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11824656#M2868</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-16T00:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11826758#M2869</link>
      <description>&lt;P&gt;It took a little hunting but I found out how to find the location of the sun (not just the compass rose).&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;sun.manual_sun_position &lt;/LI-CODE&gt;&lt;P&gt;Is the position of the sun relative to the Sun Positioner.&amp;nbsp; Multiply this times the transform of the Sun Positioner transform to get the world coordinates.&lt;/P&gt;&lt;P&gt;The following will determine the reflected ray&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="leeminardi_0-1678990677994.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1189692iC95D09016CC78A07/image-size/medium?v=v2&amp;amp;px=400" role="button" title="leeminardi_0-1678990677994.png" alt="leeminardi_0-1678990677994.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I think v should equal a vector from the compass rose to the sun and not from the surface. For a sun system all light rays should be considered parallel on earth and not from a point light source close to earth so V should =&amp;nbsp;normalize(sunpos - compassT.pos) and NOT&amp;nbsp;normalize(sunpos - surface.pos).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can manually move the sun&amp;nbsp; or move/rotate&amp;nbsp; the surface in the attached file and the "reflected ray" should adjust accordingly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Mar 2023 18:25:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11826758#M2869</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-16T18:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11832806#M2870</link>
      <description>&lt;P&gt;Hi again Lee,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly thanks for your help with this!&lt;BR /&gt;I typically work with VRay and use the Daylight system (systems panel&amp;gt;daylight), but think it is a similar set up - directional light, controller, compass helper. I am trying to simulate where sunlight would (in theory) be reflected from a solar farm. . At the moment(using the file you so kindly supplied), I can manually move/snap the sunOrigin to the helper to the directional light (sun) - this is already really useful. I guess I thought we could bypass the helper object and reference the directional light object directly, it would always be correct. Failing that I figured a basic position constraint or link from the sunOrigin helper to the dir light would be possible, but when i tried this, it seemed to mess with the surface and reflect line relationship.&lt;BR /&gt;I need to get more familiar with controllers and constraints, so will definitely check your tutorials.&lt;BR /&gt;Thanks again for your help&lt;/P&gt;&lt;P&gt;Corey&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 02:26:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11832806#M2870</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-20T02:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11832812#M2871</link>
      <description>&lt;P&gt;Hi again Lee,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Firstly thanks for your help with this!&lt;BR /&gt;I typically work with VRay and use the Daylight system (systems panel&amp;gt;daylight), but think it is a similar set up - directional light, controller, compass helper. I am trying to simulate where sunlight would (in theory) be reflected from a solar farm. . At the moment(using the file you so kindly supplied), I can manually move/snap the sunOrigin to the helper to the directional light (sun) - this is already really useful. I guess I thought we could bypass the helper object and reference the directional light object directly, it would always be correct. Failing that I figured a basic position constraint or link from the sunOrigin helper to the dir light would be possible, but when i tried this, it seemed to mess with the surface and reflect line relationship.&lt;BR /&gt;I need to get more familiar with controllers and constraints, so will definitely check your tutorials.&lt;BR /&gt;Thanks again for your help,&lt;/P&gt;&lt;P&gt;Corey&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 02:35:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11832812#M2871</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-20T02:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11832872#M2872</link>
      <description>&lt;P&gt;Corey,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I forgot to attach the file in my last post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Open the file and select SunPositioner001 and then go to the MOdify panel and select the Sun sub-object.&amp;nbsp; You can move the sun and the "ray" will reflect accordingly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Select Point001 and then double click Position Script in the Motion Panel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that there are two lines " v = ..._ The one that is commented out with -- sets the angle of sunlight to the vector from the surface to the sun's position.&amp;nbsp; The one that is active sets the angle of the sunlight vector from the compass rose to the sun's position.&amp;nbsp; As I mentioned earlier, I think this is the vector you should use as it defines the direction of sunlight on earth and not from a sun that's close to earth!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;sunpos = sun.manual_sun_position * compassT
v = normalize(sunpos - compassT.pos)
-- v = normalize(sunpos - surface.pos)
n = surface.row3
r = normalize(2 * (dot v n) *  n - v)
pt = surface.pos + 10 * r&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if you have any questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Mar 2023 03:46:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11832872#M2872</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-20T03:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11835673#M2873</link>
      <description>&lt;P&gt;Hi Lee&lt;/P&gt;&lt;P&gt;Thanks for the file. OK, that makes sense re using the compass rose instead of the surface - that is also great because I can move the surface around the scene and the angle will still be correct.&amp;nbsp;sun.manual_sun_position certainly is hidden away in there! I was intending to use the 'Date, Time &amp;amp; Location' feature of SunPositioner, but when I switch that in the file it seems to break the controller - but works again if I switch back. I couldnt see anything obvious in the reference for SunPositioner (like&amp;nbsp;sun.dtl_sun_position?!) but I guess when you enable DT&amp;amp;L, sun.manual_sun_position is no longer valid.&lt;BR /&gt;&lt;BR /&gt;I always use the Daylight System (easy to switch to VRay Sun), which I think is similar:&lt;BR /&gt;&lt;A href="https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-9EEFF581-95CC-4D3C-887F-A7E1B2752C4F" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-9EEFF581-95CC-4D3C-887F-A7E1B2752C4F&lt;/A&gt;&lt;/P&gt;&lt;P&gt;it has a compass, and maybe you can access the light using&amp;nbsp;&lt;SPAN class=""&gt;&amp;lt;Sunlight_Driven_Controller&amp;gt;.manual_position&lt;/SPAN&gt;&amp;nbsp;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will have a go and see if i can swap out the SunPositioner object for a Daylight system. In the attached file, i made the surface only rotate on Y and added a Daylight system&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Corey&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 08:13:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11835673#M2873</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-21T08:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11836531#M2874</link>
      <description>&lt;P&gt;You can use the following to get the sun direction vector&amp;nbsp; "v"&amp;nbsp; (the minus sign changes the sense to pointing towards the sun).&lt;/P&gt;&lt;LI-CODE lang="general"&gt;TheSun = $Daylight001
v = -TheSun.transform.row3
format "\nSunVector = %" v&lt;/LI-CODE&gt;&lt;P&gt;v&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 14:25:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11836531#M2874</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-21T14:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11836536#M2875</link>
      <description>&lt;P&gt;You can use the following to get the sun vector "v" ( the minus sign change the sense to pointing towards the sun).&lt;/P&gt;&lt;LI-CODE lang="general"&gt;TheSun = $Daylight001
v = -TheSun.transform.row3
format "\nSunVector = %" v&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; With this approach you can set the date and time and the vector will update accordingly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2023 14:27:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11836536#M2875</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-21T14:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11840553#M2876</link>
      <description>&lt;P&gt;Hi - I added that additional code and got it working, i had to remove the minus sign in line two to get it to reflect rather then continue through the surface. One issue is that it doesn't update when changing the time/date until you hit 'evaluate'.&lt;BR /&gt;&lt;BR /&gt;Before seeing your reply i tried to change the values to use Daylight001 with the previous approach:&lt;BR /&gt;compassT - use Daylight System object compass (as previous with SunPositioner)&lt;BR /&gt;sun - assigned this to use Daylight001 manual position track.&lt;/P&gt;&lt;P&gt;This seems to work, and updates when i change time/day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CoreyMurray_0-1679521695692.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1192176i47CAA0A3B797C196/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CoreyMurray_0-1679521695692.png" alt="CoreyMurray_0-1679521695692.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CoreyMurray_1-1679521997703.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1192178iAE8581426C815557/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CoreyMurray_1-1679521997703.png" alt="CoreyMurray_1-1679521997703.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution seems to utilize the properties of Daylight001 more efficiently.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Corey&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 21:55:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11840553#M2876</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-22T21:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11840779#M2877</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3446815"&gt;@CoreyMurray&lt;/a&gt;&amp;nbsp;it's not clear to me if you have a satisfactory solution.&amp;nbsp; Does the system update when you change the date/time?&amp;nbsp; &amp;nbsp;If not, please attach your latest version of the Max file that includes the script for point001.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 00:34:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11840779#M2877</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-23T00:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11840894#M2878</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;File attached. This is the previous file you posted, I made the changes to use the Daylight System:&lt;/P&gt;&lt;PRE&gt;TheSun = $Daylight001
v = -TheSun.transform.row3
format "\nSunVector = %" v&lt;/PRE&gt;&lt;P&gt;Is there a way to make the reflected line update when the sun changes automatically, without having to hit re-evaluate? Apologies if I have missed something, I'm totally out of my depth here haha.&lt;BR /&gt;Thanks ☺&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 02:05:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11840894#M2878</guid>
      <dc:creator>CoreyMurray</dc:creator>
      <dc:date>2023-03-23T02:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: reflect vector on surface - like a lazer!</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11842341#M2879</link>
      <description>&lt;P&gt;Just Assign Node of Daylight001 to TheSun so that changes to Daylight001 will cause the script to be executed.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="leeminardi_0-1679579798317.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1192528iD2759B0E636A7EBB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="leeminardi_0-1679579798317.png" alt="leeminardi_0-1679579798317.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 13:58:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/reflect-vector-on-surface-like-a-lazer/m-p/11842341#M2879</guid>
      <dc:creator>leeminardi</dc:creator>
      <dc:date>2023-03-23T13:58:22Z</dc:date>
    </item>
  </channel>
</rss>

