Jump to: Board index » General » Fusion

Laser simulation: "Look at" rotation expression

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Laser simulation: "Look at" rotation expression

PostThu Jan 18, 2018 7:39 pm

Today I'm trying to simulate a laser beam hitting different parts of an object.

- I create static particles on the surface of the object.
- Spawn those particles, creating long thin green lines.

Now I can set he angle those laser beams are created, but all of them are paralel. I want to simulate all the beams come from one point above. I mean, the lines shoud have x and z axis looking at certain point on space.

Something similar to "always face to camera", but facing to a third object. (and rotating xz instead of xy)

I've found I need an expresssion based in an arctangent of the angle between world axis and the vector (particle-target) but can't figure how to build it.

I'm on my first days handling epressions. Even worse, my math knwledge is buried under 30 years of easy 3DStudio Max animation controllers and now I can't do nothing by myself... Shame.

I guess this is one of the most commonly used expressions by advanced Fusioneers. Isn't it?
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Re: Laser simulation: "Look at" rotation expression

PostThu Jan 18, 2018 7:49 pm

Make the lines converge in the ball

Code: Select all
Composition {
   CurrentTime = 26,
   RenderRange = { 0, 1000 },
   GlobalRange = { 0, 1000 },
   CurrentID = 15,
   PlaybackUpdateMode = 0,
   Version = "Fusion 9.0.2 build 15",
   SavedOutputs = 0,
   HeldTools = 0,
   DisabledTools = 0,
   LockedTools = 0,
   AudioOffset = 0,
   AutoRenderRange = true,
   Resumable = true,
   OutputClips = {
   },
   Tools = {
      Shape3D1 = Shape3D {
         Inputs = {
            Shape = Input { Value = FuID { "SurfaceTorusInputs" }, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 1, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 1, },
            ["SurfaceTorusInputs.Radius"] = Input { Value = 2.158, },
            ["SurfaceTorusInputs.Section"] = Input { Value = 0.662, },
            ["SurfaceTorusInputs.Visibility.Nest"] = Input { Value = 1, },
            ["SurfaceTorusInputs.Visibility.IsVisible"] = Input { Value = 0, },
            ["SurfaceTorusInputs.Visibility.IsUnseenByCameras"] = Input { Value = 1, },
            ["SurfaceTorusInputs.ObjectID.ObjectID"] = Input { Value = 3, }
         },
         ViewInfo = OperatorInfo { Pos = { -918, 247 } },
      },
      BASE_PARTICLES_1_2 = pEmitter {
         ID = 10,
         NameSet = true,
         Inputs = {
            Number = Input {
               Value = 0,
               Expression = "iif(time==0,(Numero*ZERO),0)",
            },
            Lifespan = Input { Value = 10000, },
            Set9 = Input { Value = 1, },
            Region = Input { Value = FuID { "MeshRegion" }, },
            Numero = Input { Value = 100, },
            ZERO = Input { Value = 1, },
            ["ParticleStyle.ColorControls"] = Input { Value = 1, },
            ["ParticleStyle.SizeControls"] = Input { Value = 1, },
            ["ParticleStyle.Size"] = Input { Value = 0.3481, },
            ["ParticleStyle.SizeOverLife"] = Input {
               SourceOp = "BASE_PARTICLES_1_2SizeoverLife",
               Source = "Value",
            },
            ["ParticleStyle.BlurOverLife"] = Input {
               SourceOp = "BASE_PARTICLES_1_2BluroverLife2D",
               Source = "Value",
            },
            ["MeshRegion.RegionType"] = Input { Value = 0, },
            ["MeshRegion.MeshInput"] = Input {
               SourceOp = "Shape3D1",
               Source = "Output",
            }
         },
         ViewInfo = OperatorInfo { Pos = { -755.68, 249.074 } },
         UserControls = ordered() {
            Numero = {
               INP_MaxAllowed = 1000000,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_Steps = 100,
               INP_MaxScale = 100000,
               INP_Default = 100000,
               INP_MinScale = 0,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               INP_External = false,
               ICD_Center = 100000,
               ICS_ControlPage = "Controls",
               LINKS_Name = "CantidadInicial"
            },
            ZERO = {
               INP_MaxAllowed = 1,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_Steps = 1,
               INP_MaxScale = 1,
               INP_MinScale = 0,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               INP_External = false,
               ICD_Center = 1,
               ICS_ControlPage = "Controls",
               LINKS_Name = "ZERO"
            }
         }
      },
      BASE_PARTICLES_1_2SizeoverLife = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      BASE_PARTICLES_1_2BluroverLife2D = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      LASER = pSpawn {
         ID = 6,
         NameSet = true,
         CustomData = {
            Settings = {
               [1] = {
                  Tools = ordered() {
                     pSpawn1 = pSpawn {
                        Inputs = {
                           Number = Input { Value = 5 },
                           AlwaysFaceCamera = Input { Value = 0 },
                           VelocityControls = Input { Value = 1 },
                           Velocity = Input { Value = 0.701 },
                           ["ParticleStyleBitmap.Animate"] = Input { Value = 1 },
                           ["ParticleStyle.BlurOverLife"] = Input {
                              SourceOp = "pSpawn1BluroverLife2D",
                              Source = "Value"
                           },
                           Angle = Input { Value = 90 },
                           ["ParticleStyle.FadeOut"] = Input { Value = 0.741 },
                           AngleZVariance = Input { Value = 67.5 },
                           TemporalDistribution = Input { Value = 1 },
                           ["ParticleStyleBitmap.DropToolsHere"] = Input {
                              SourceOp = "Background3",
                              Source = "Output"
                           },
                           AngleVariance = Input { Value = 90 },
                           Style = Input { Value = FuID { "ParticleStyleBitmap" } },
                           ["ParticleStyle.FadeIn"] = Input { Value = 0.115 },
                           ["ParticleStyle.SizeVariance"] = Input { Value = 0.1192 },
                           ["ParticleStyle.Size"] = Input { Value = 0.04 },
                           ["ParticleStyle.FadeControls"] = Input { Value = 1 },
                           ["ParticleStyle.SizeOverLife"] = Input {
                              SourceOp = "pSpawn1SizeoverLife",
                              Source = "Value"
                           },
                           RotationMode = Input { Value = 1 },
                           Lifespan = Input { Value = 5 },
                           ["ParticleStyle.ColorControls"] = Input { Value = 1 },
                           LifespanVariance = Input { Value = 13.1 },
                           Input = Input {
                              SourceOp = "pKill1",
                              Source = "Output"
                           },
                           VelocityVariance = Input { Value = 3 },
                           ["ParticleStyle.SizeControls"] = Input { Value = 1 },
                           NewSet2 = Input { Value = 1 },
                           NumberVariance = Input { Value = 2 }
                        },
                        Name = "pSpawn1",
                        CtrlWZoom = false,
                        ID = 42,
                        ViewInfo = OperatorInfo { Pos = { 1021.33, 330.612 } },
                        CustomData = {
                        }
                     },
                     pSpawn1SizeoverLife = LUTBezier {
                        SplineColor = { Green = 128, Blue = 64, Red = 192 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        },
                        Name = "pSpawn1SizeoverLife"
                     },
                     pSpawn1BluroverLife2D = LUTBezier {
                        SplineColor = { Green = 128, Blue = 64, Red = 192 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        },
                        Name = "pSpawn1BluroverLife2D"
                     }
                  }
               },
               [2] = {
                  Tools = ordered() {
                     pSpawn1 = pSpawn {
                        Inputs = {
                           Number = Input { Value = 0 },
                           AlwaysFaceCamera = Input { Value = 0 },
                           VelocityControls = Input { Value = 1 },
                           Velocity = Input { Value = 0.701 },
                           ["ParticleStyleBitmap.Animate"] = Input { Value = 1 },
                           ["ParticleStyle.BlurOverLife"] = Input {
                              SourceOp = "pSpawn1BluroverLife2D",
                              Source = "Value"
                           },
                           Angle = Input { Value = 90 },
                           ["ParticleStyle.FadeOut"] = Input { Value = 0.741 },
                           AngleZVariance = Input { Value = 67.5 },
                           TemporalDistribution = Input { Value = 1 },
                           ["ParticleStyleBitmap.DropToolsHere"] = Input {
                              SourceOp = "Background3",
                              Source = "Output"
                           },
                           AngleVariance = Input { Value = 90 },
                           Style = Input { Value = FuID { "ParticleStyleBitmap" } },
                           ["ParticleStyle.FadeIn"] = Input { Value = 0.115 },
                           ["ParticleStyle.SizeVariance"] = Input { Value = 0.1192 },
                           ["ParticleStyle.Size"] = Input { Value = 0.04 },
                           ["ParticleStyle.FadeControls"] = Input { Value = 1 },
                           ["ParticleStyle.SizeOverLife"] = Input {
                              SourceOp = "pSpawn1SizeoverLife",
                              Source = "Value"
                           },
                           RotationMode = Input { Value = 1 },
                           Lifespan = Input { Value = 5 },
                           ["ParticleStyle.ColorControls"] = Input { Value = 1 },
                           LifespanVariance = Input { Value = 13.1 },
                           Input = Input {
                              SourceOp = "pKill1",
                              Source = "Output"
                           },
                           VelocityVariance = Input { Value = 3 },
                           ["ParticleStyle.SizeControls"] = Input { Value = 1 },
                           NewSet2 = Input { Value = 1 },
                           NumberVariance = Input { Value = 2 }
                        },
                        CtrlWZoom = false,
                        ID = 42,
                        ViewInfo = OperatorInfo { Pos = { 1021.33, 330.612 } },
                        CustomData = {
                        }
                     },
                     pSpawn1SizeoverLife = LUTBezier {
                        SplineColor = { Green = 128, Blue = 64, Red = 192 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        }
                     },
                     pSpawn1BluroverLife2D = LUTBezier {
                        SplineColor = { Green = 128, Blue = 64, Red = 192 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        }
                     }
                  }
               },
            }
         },
         Inputs = {
            ["ParticleStyleBitmap.Animate"] = Input { Value = 1, },
            Number = Input { Value = 3.8, },
            Lifespan = Input { Value = 1, },
            LifespanVariance = Input { Value = 3, },
            PositionVariance = Input { Value = 0.1, },
            TemporalDistribution = Input { Value = 1, },
            VelocityControls = Input { Value = 1, },
            VelocityTransfer = Input { Value = 0, },
            Velocity = Input { Value = 0.028, },
            RotationControls = Input { Value = 1, },
            RotationMode = Input { Value = 1, },
            AlwaysFaceCamera = Input { Value = 0, },
            Rotation = Input { Value = 1, },
            RotationZ = Input { Value = -90, },
            NewSet10 = Input { Value = 1, },
            Input = Input {
               SourceOp = "BASE_PARTICLES_1_2",
               Source = "Output",
            },
            Style = Input { Value = FuID { "ParticleStyleLine" }, },
            Region = Input { Value = FuID { "CubeRgn" }, },
            ["ParticleStyle.Red"] = Input { Value = 0, },
            ["ParticleStyle.Green"] = Input { Value = 0.507, },
            ["ParticleStyle.Blue"] = Input { Value = 0, },
            ["ParticleStyle.RedLow"] = Input { Value = -0.104, },
            ["ParticleStyle.RedHigh"] = Input { Value = 0.13, },
            ["ParticleStyle.GreenLow"] = Input { Value = 0.052, },
            ["ParticleStyle.GreenHigh"] = Input { Value = 1, },
            ["ParticleStyle.BlueLow"] = Input { Value = -0.195, },
            ["ParticleStyle.BlueHigh"] = Input { Value = 0.299, },
            ["ParticleStyle.AlphaLow"] = Input { Value = -1, },
            ["ParticleStyle.AlphaHigh"] = Input { Value = 1, },
            ["ParticleStyle.Size"] = Input { Value = 25, },
            ["ParticleStyle.SizeVariance"] = Input { Value = 5, },
            ["ParticleStyle.SizeOverLife"] = Input {
               SourceOp = "LASERSizeoverLife",
               Source = "Value",
            },
            ["ParticleStyle.FadeControls"] = Input { Value = 1, },
            ["ParticleStyle.FadeOut"] = Input { Value = 0.546, },
            ["ParticleStyle.MergeControls"] = Input { Value = 1, },
            ["ParticleStyle.BlurOverLife"] = Input {
               SourceOp = "LASERBluroverLife2D",
               Source = "Value",
            },
            ["CubeRgn.Translate.X"] = Input {
               Value = 4.44089209850063e-016,
               Expression = "MASTER_H_WAVE.Transform3DOp.Translate.X",
            },
            ["CubeRgn.Translate.Y"] = Input {
               Value = 0.326465011923907,
               Expression = "MASTERLIFT.Transform3DOp.Translate.Y",
            },
            ["CubeRgn.Width"] = Input { Value = 0.889, },
            ["CubeRgn.Height"] = Input { Value = 0.197, },
            ["CubeRgn.Depth"] = Input { Value = 0.15, }
         },
         ViewInfo = OperatorInfo { Pos = { -433.63, 254.37 } },
      },
      LASERSizeoverLife = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      LASERBluroverLife2D = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      pRender1_1_2 = pRender {
         Inputs = {
            _MotionBlurWarning = Input { Disabled = true, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            OutputMode = Input { Disabled = true, },
            SubFrameCalculationAccuracy = Input { Value = 2, },
            ["MaterialID.MaterialID"] = Input { Value = 2, },
            ["ObjectID.ObjectID"] = Input { Value = 2, },
            Input = Input {
               SourceOp = "LASER",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 14.3199, 249.074 } },
      },
      Look_At_This_Please = Shape3D {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            ["Transform3DOp.Translate.Y"] = Input { Value = 5.32554814649583, },
            Shape = Input { Value = FuID { "SurfaceSphereInputs" }, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 3, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 4, },
            ["SurfaceSphereInputs.Radius"] = Input { Value = 0.13, },
            ["SurfaceSphereInputs.ObjectID.ObjectID"] = Input { Value = 5, }
         },
         ViewInfo = OperatorInfo { Pos = { 61, 58 } },
      },
      Merge3D4_1 = Merge3D {
         Inputs = {
            SceneInput1 = Input {
               SourceOp = "pRender1_1_2",
               Source = "Output",
            },
            SceneInput2 = Input {
               SourceOp = "Look_At_This_Please",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 172.32, 248.074 } },
      }
   },
   Views = {
      {
         FrameTypeID = "ChildFrame",
         Mode = 3,
         LayoutPreset = 0,
         Left = 0,
         Top = 27,
         Width = 2560,
         Height = 1272,
         Views = ordered() {
            Main = MultiView {
               Active = "Flow",
               ViewList = ordered() {
                  Flow = "FlowView",
                  Console = "ConsoleView",
                  Timeline = "TimelineView",
                  Spline = "SplineEditorView",
                  Info = "InfoView",
                  Chat = "ChatView"
               },
               Flow = FlowView {
                  Flags = {
                     AutoHideNavigator = true,
                     AutoSnap = true,
                     RemoveRouters = true
                  },
                  NavigatorSize = { 200, 140 },
                  Direction = "Horizontal",
                  PipeStyle = "Direct",
                  Scale = 1,
                  Offset = { 1233, 98 }
               },
               Timeline = TimelineView {
                  TreeControlState = {
                  },
                  DisplayMode = "All Tools",
                  ShowCurrentTimeTools = false,
                  Filter = "Show All",
                  ShowSelectedTools = false,
                  ShowAnimatedToolsOnly = false,
                  ShowEditBoxes = false,
                  KeyFrameView = {
                     Position = { Left = 150, Bottom = 350 },
                     ScaleX = 2.14424951267057,
                     OffsetX = -49.317738791423,
                     OffsetY = 0,
                     AutoScaling = "scroll",
                     AutoSnapTo = "frame",
                     AutoSnapToGuidelines = false,
                     GuidelinesGrabEnabled = true,
                     GuidelinesSnapTo = "frame"
                  },
                  Spreadsheet = { LeftPos = 150, Visible = false }
               },
               Spline = SplineEditorView {
                  LeftPos = 238,
                  ScaleX = 0.2,
                  ScaleY = 0.00338983050847458,
                  OffsetX = -3.8,
                  OffsetY = 0,
                  AutoScaling = "scroll",
                  AutoSnapTo = "frame",
                  AutoSnapToGuidelines = false,
                  GuidelinesSnapTo = "frame",
                  ShowKeyMarkers = false,
                  IndependentHandles = false,
                  ShowNonSplineModifiers = false,
                  GuidelinesGrabEnabled = true,
                  ShowOneToolOnly = false,
                  ShowSelectedTools = false,
                  ShowAllInputs = false,
                  Filter = "Show All"
               },
            },
            Controls = MultiView {
               Active = "Tools",
               ViewList = ordered() {
                  Tools = "ControlView",
                  Modifiers = "ModifierView"
               },
            },
            Left = "PreviewContainer",
            Right = "PreviewContainer",
            Transport = "TransportView",
            Time = "TimeView"
         },
         Layout = {
            Columns = 2,
            RatioX = 1,
            RatioY = 1,
            {
               Rows = 3,
               RatioX = 0.458267716535433,
               RatioY = 100,
               {
                  Columns = 2,
                  RatioX = 1,
                  RatioY = 0.438559322033898,
                  { ID = "Left", RatioX = 0.5, RatioY = 100, Pop = true },
                  { ID = "Right", RatioX = 0.5, Pop = true },
                  Pop = true
               },
               { ID = "Main", RatioY = 0.438559322033898, Pop = true },
               { ID = "Time", SnapY = 56, Flat = true }
            },
            {
               Rows = 2,
               PixelX = 342,
               { ID = "Controls", RatioX = 1, RatioY = 1 },
               { ID = "Transport", FixedY = -2 }
            }
         }
      }
   },
   Prefs = {
      Comp = {
         Paths = {
         },
         LastFile = "R:\\_Stealth Key III\\max\\LLave mapeada y colocada_centimetros sin smooth.FBX",
         FrameFormat = {
            GuideRatio = 1.77777777777778,
            Rate = 25,
         },
         AVI = {
            Saver = {
               Handler = 1196444237,
            }
         },
         Memory = {
            Render = {
               SimultaneousBranching = true
            },
            FramesAtOnce = 8,
         },
         Views = {
            Right = {
               SideB = {
                  PrevCtrlInactiveColor = 4278255360,
                  PickW = 1,
                  PickH = 1,
                  PrevCtrlActiveColor = 4278190335,
                  Viewer = {
                     EnableLUTs = false,
                     LUTPlugin = "FusionViewLUT",
                     FitMarginY = 0,
                     FitMarginX = 0,
                     FitMarginType = 0,
                     FarZ = -1000,
                     NearZ = 0
                  }
               },
               Viewer = {
               },
               View3D = {
                  CameraName = "Perspective",
                  CamPersp = {
                     Position = {
                        X = -0.048521488904953,
                        Y = -1.50897979736328,
                        Z = 1.00561952590942
                     },
                     Rotation = {
                        X = 26.6000003814697,
                        Y = -38.5999984741211,
                        Z = 0
                     },
                     Scale = 0.178006276488304
                  },
                  CamFront = {
                     Position = {
                        X = 0,
                        Y = 0,
                        Z = 0
                     },
                     Rotation = {
                        X = 0,
                        Y = 0,
                        Z = 0
                     },
                     Scale = 1
                  },
                  CamTop = {
                     Position = {
                        X = 0,
                        Y = 0,
                        Z = 0
                     },
                     Rotation = {
                        X = 90,
                        Y = 0,
                        Z = 0
                     },
                     Scale = 1
                  },
                  CamRight = {
                     Position = {
                        X = 0,
                        Y = 0,
                        Z = 0
                     },
                     Rotation = {
                        X = 0,
                        Y = -90,
                        Z = 0
                     },
                     Scale = 1
                  },
                  CamLeft = {
                     Position = {
                        X = 0,
                        Y = 0,
                        Z = 0
                     },
                     Rotation = {
                        X = 0,
                        Y = 90,
                        Z = 0
                     },
                     Scale = 1
                  }
               }
            },
            View1 = {
               PrevCtrlInactiveColor = 0,
               PickW = 0,
               PickH = 0,
               SideB = {
                  PrevCtrlInactiveColor = 4278255360,
                  PickW = 1,
                  PickH = 1,
                  PrevCtrlActiveColor = 4278190335,
                  Viewer = {
                     EnableLUTs = false,
                     LUTPlugin = "FusionViewLUT",
                     FitMarginY = 0,
                     FitMarginX = 0,
                     FitMarginType = 0,
                     FarZ = -1000,
                     NearZ = 0
                  }
               },
               PrevCtrlActiveColor = 0
            },
            Left = {
               SideB = {
                  PrevCtrlInactiveColor = 4278255360,
                  PickW = 1,
                  PickH = 1,
                  PrevCtrlActiveColor = 4278190335,
                  Viewer = {
                     EnableLUTs = false,
                     LUTPlugin = "FusionViewLUT",
                     FitMarginY = 0,
                     FitMarginX = 0,
                     FitMarginType = 0,
                     FarZ = -1000,
                     NearZ = 0
                  }
               },
            },
         },
         QuickTime = {
            Compressor = "DNxHD HQ 1080p 8bit_AVdn",
         },
      }
   }
}

 
Offline

Okke Verbart

  • Posts: 290
  • Joined: Tue Jan 17, 2017 8:40 pm

Re: Laser simulation: "Look at" rotation expression

PostThu Jan 18, 2018 9:01 pm

Hey Ignacio - I would tackle this with the pCustom: feed the x,y and z offset of your target to n1-n3 of the pCustom. Then in the particle tab, add some expressions to the Rotation Y and Z making use of the particle distance of each particle (abs(px-n1), abs(py-n2), abs(pz-n3) and then some clever SOHCATOA!

I had a quick play, and it should definitely work...I didn't have enough time to make it work properly though...hence no code snippet ;-)
www.ablackbirdcalledsue.com
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Re: Laser simulation: "Look at" rotation expression

PostThu Jan 18, 2018 10:24 pm

I'm on it. I'm slow to these things, need to draw it... :(

Why pcustom? If I set the right angle at birth, with an expression on X and Z rotation, each particle will have is own angle pointing to the target.

* using the target's position as operands in that expression, obviously.


Edit: If I'm not too lost, I think Z rotation shoud be

atan((py-ty)/(px-tx))

and the X rotation

atan((py-ty)/(p-tz))

as soon as this render ends, I'll try it.

I guess I'll need pcustom to have access to each particle XYZ.
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Re: Laser simulation: "Look at" rotation expression

PostThu Jan 18, 2018 11:34 pm

can't make it work.

I set X and Z rotation expressions guided by the "toa" of sokotoa.

After going crazy for a while, I realized arctan returns the angle in radians.

Then I include my expression in a deg(), but returns always 0 (fails). Seems deg() is not accepted.

But I've checkd syntax: deg(atan(1)) returns 45. It's working. But not in my expression. Checked parenthesis nesting carefully.

I'm ofuscated. May be tomorrow with fresh head...
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Laser simulation: "Look at" rotation expression

PostFri Jan 19, 2018 1:14 am

You could try doing the conversion explicitly: (atan() * 180) / pi
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

Okke Verbart

  • Posts: 290
  • Joined: Tue Jan 17, 2017 8:40 pm

Re: Laser simulation: "Look at" rotation expression

PostFri Jan 19, 2018 7:19 am

I guess I'll need pcustom to have access to each particle XYZ.


Exactly that indeed.

In terms of degrees versus radians. It seems to me that in the numbers tab, it returns the result in radians, but in the particle tab in degrees :-(

Try adding say atan(1) in Numberin1. That yields something like 0.785 (radians). And if you then add deg(atan(1)) you get 45 degrees.

Now move over to the particle tab (in your comp) and add 45 to the Rotation Y, look at the screen, then replace by atan(1).... same result, right? So, atan(1) must yield the result in degrees when entered in the particle tab (or something else weird is going on!)

To make matters "worse".... now add an expression modifier to Numberin2 and add atan(1) in the modifier NumberOut tab.... check Numberin2 --> bang, back in degree land!
www.ablackbirdcalledsue.com
Offline

Okke Verbart

  • Posts: 290
  • Joined: Tue Jan 17, 2017 8:40 pm

Re: Laser simulation: "Look at" rotation expression

PostFri Jan 19, 2018 7:38 am

I think I've got it (or at least close to). Used atan2 instead of atan to take into account of the quadrants:

Code: Select all
{
   Tools = ordered() {
      Shape3D1 = Shape3D {
         Inputs = {
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 1, },
            Shape = Input { Value = FuID { "SurfaceTorusInputs" }, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 1, },
            ["SurfaceTorusInputs.Radius"] = Input { Value = 2.158, },
            ["SurfaceTorusInputs.Section"] = Input { Value = 0.662, },
            ["SurfaceTorusInputs.Visibility.Nest"] = Input { Value = 1, },
            ["SurfaceTorusInputs.Visibility.IsVisible"] = Input { Value = 0, },
            ["SurfaceTorusInputs.Visibility.IsUnseenByCameras"] = Input { Value = 1, },
            ["SurfaceTorusInputs.ObjectID.ObjectID"] = Input { Value = 3, }
         },
         ViewInfo = OperatorInfo { Pos = { 202.68, 75.926 } },
      },
      BASE_PARTICLES_1_2 = pEmitter {
         ID = 2,
         NameSet = true,
         Inputs = {
            Number = Input {
               Value = 100,
               Expression = "iif(time==0,(Numero*ZERO),0)",
            },
            Lifespan = Input { Value = 10000, },
            Set9 = Input { Value = 1, },
            Region = Input { Value = FuID { "MeshRegion" }, },
            Numero = Input { Value = 100, },
            ZERO = Input { Value = 1, },
            ["ParticleStyle.ColorControls"] = Input { Value = 1, },
            ["ParticleStyle.SizeControls"] = Input { Value = 1, },
            ["ParticleStyle.Size"] = Input { Value = 0.3481, },
            ["ParticleStyle.SizeOverLife"] = Input {
               SourceOp = "BASE_PARTICLES_1_2SizeoverLife",
               Source = "Value",
            },
            ["ParticleStyle.BlurOverLife"] = Input {
               SourceOp = "BASE_PARTICLES_1_2BluroverLife2D",
               Source = "Value",
            },
            ["MeshRegion.RegionType"] = Input { Value = 0, },
            ["MeshRegion.MeshInput"] = Input {
               SourceOp = "Shape3D1",
               Source = "Output",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 365, 78 } },
         UserControls = ordered() {
            Numero = {
               INP_MaxAllowed = 1000000,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_Steps = 100,
               INP_MaxScale = 100000,
               INP_Default = 100000,
               INP_MinScale = 0,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               INP_External = false,
               ICS_ControlPage = "Controls",
               ICD_Center = 100000,
               LINKS_Name = "CantidadInicial"
            },
            ZERO = {
               INP_MaxAllowed = 1,
               INP_Integer = true,
               INPID_InputControl = "SliderControl",
               IC_Steps = 1,
               INP_MaxScale = 1,
               INP_MinScale = 0,
               INP_MinAllowed = 0,
               LINKID_DataType = "Number",
               INP_External = false,
               ICS_ControlPage = "Controls",
               ICD_Center = 1,
               LINKS_Name = "ZERO"
            }
         }
      },
      BASE_PARTICLES_1_2SizeoverLife = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      BASE_PARTICLES_1_2BluroverLife2D = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      LASER = pSpawn {
         ID = 7,
         NameSet = true,
         CustomData = {
            Settings = {
               [1] = {
                  Tools = ordered() {
                     pSpawn1 = pSpawn {
                        Inputs = {
                           Number = Input { Value = 5 },
                           AlwaysFaceCamera = Input { Value = 0 },
                           VelocityControls = Input { Value = 1 },
                           Velocity = Input { Value = 0.701 },
                           NumberVariance = Input { Value = 2 },
                           NewSet2 = Input { Value = 1 },
                           AngleZVariance = Input { Value = 67.5 },
                           VelocityVariance = Input { Value = 3 },
                           Angle = Input { Value = 90 },
                           TemporalDistribution = Input { Value = 1 },
                           ["ParticleStyleBitmap.DropToolsHere"] = Input {
                              SourceOp = "Background3",
                              Source = "Output"
                           },
                           Input = Input {
                              SourceOp = "pKill1",
                              Source = "Output"
                           },
                           LifespanVariance = Input { Value = 13.1 },
                           AngleVariance = Input { Value = 90 },
                           ["ParticleStyle.ColorControls"] = Input { Value = 1 },
                           Lifespan = Input { Value = 5 },
                           ["ParticleStyle.FadeControls"] = Input { Value = 1 },
                           ["ParticleStyle.SizeOverLife"] = Input {
                              SourceOp = "pSpawn1SizeoverLife",
                              Source = "Value"
                           },
                           RotationMode = Input { Value = 1 },
                           ["ParticleStyle.Size"] = Input { Value = 0.04 },
                           ["ParticleStyle.SizeVariance"] = Input { Value = 0.1192 },
                           Style = Input { Value = FuID { "ParticleStyleBitmap" } },
                           ["ParticleStyle.FadeIn"] = Input { Value = 0.115 },
                           ["ParticleStyle.FadeOut"] = Input { Value = 0.741 },
                           ["ParticleStyle.SizeControls"] = Input { Value = 1 },
                           ["ParticleStyle.BlurOverLife"] = Input {
                              SourceOp = "pSpawn1BluroverLife2D",
                              Source = "Value"
                           },
                           ["ParticleStyleBitmap.Animate"] = Input { Value = 1 }
                        },
                        Name = "pSpawn1",
                        CtrlWZoom = false,
                        ID = 42,
                        ViewInfo = OperatorInfo { Pos = { 1021.33, 330.612 } },
                        CustomData = {
                        }
                     },
                     pSpawn1SizeoverLife = LUTBezier {
                        SplineColor = { Red = 192, Blue = 64, Green = 128 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        },
                        Name = "pSpawn1SizeoverLife"
                     },
                     pSpawn1BluroverLife2D = LUTBezier {
                        SplineColor = { Red = 192, Blue = 64, Green = 128 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        },
                        Name = "pSpawn1BluroverLife2D"
                     }
                  }
               },
               [2] = {
                  Tools = ordered() {
                     pSpawn1 = pSpawn {
                        Inputs = {
                           Number = Input { Value = 0 },
                           AlwaysFaceCamera = Input { Value = 0 },
                           VelocityControls = Input { Value = 1 },
                           Velocity = Input { Value = 0.701 },
                           NumberVariance = Input { Value = 2 },
                           NewSet2 = Input { Value = 1 },
                           AngleZVariance = Input { Value = 67.5 },
                           VelocityVariance = Input { Value = 3 },
                           Angle = Input { Value = 90 },
                           TemporalDistribution = Input { Value = 1 },
                           ["ParticleStyleBitmap.DropToolsHere"] = Input {
                              SourceOp = "Background3",
                              Source = "Output"
                           },
                           Input = Input {
                              SourceOp = "pKill1",
                              Source = "Output"
                           },
                           LifespanVariance = Input { Value = 13.1 },
                           AngleVariance = Input { Value = 90 },
                           ["ParticleStyle.ColorControls"] = Input { Value = 1 },
                           Lifespan = Input { Value = 5 },
                           ["ParticleStyle.FadeControls"] = Input { Value = 1 },
                           ["ParticleStyle.SizeOverLife"] = Input {
                              SourceOp = "pSpawn1SizeoverLife",
                              Source = "Value"
                           },
                           RotationMode = Input { Value = 1 },
                           ["ParticleStyle.Size"] = Input { Value = 0.04 },
                           ["ParticleStyle.SizeVariance"] = Input { Value = 0.1192 },
                           Style = Input { Value = FuID { "ParticleStyleBitmap" } },
                           ["ParticleStyle.FadeIn"] = Input { Value = 0.115 },
                           ["ParticleStyle.FadeOut"] = Input { Value = 0.741 },
                           ["ParticleStyle.SizeControls"] = Input { Value = 1 },
                           ["ParticleStyle.BlurOverLife"] = Input {
                              SourceOp = "pSpawn1BluroverLife2D",
                              Source = "Value"
                           },
                           ["ParticleStyleBitmap.Animate"] = Input { Value = 1 }
                        },
                        CtrlWZoom = false,
                        ID = 42,
                        ViewInfo = OperatorInfo { Pos = { 1021.33, 330.612 } },
                        CustomData = {
                        }
                     },
                     pSpawn1SizeoverLife = LUTBezier {
                        SplineColor = { Red = 192, Blue = 64, Green = 128 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        }
                     },
                     pSpawn1BluroverLife2D = LUTBezier {
                        SplineColor = { Red = 192, Blue = 64, Green = 128 },
                        KeyColorSplines = {
                           [0] = {
                              [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
                              [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
                           }
                        }
                     }
                  }
               },
            }
         },
         Inputs = {
            ["ParticleStyleBitmap.Animate"] = Input { Value = 1, },
            Number = Input { Value = 3.8, },
            Lifespan = Input { Value = 1, },
            LifespanVariance = Input { Value = 3, },
            PositionVariance = Input { Value = 0.1, },
            TemporalDistribution = Input { Value = 1, },
            VelocityControls = Input { Value = 1, },
            VelocityTransfer = Input { Value = 0, },
            Velocity = Input { Value = 0.028, },
            RotationControls = Input { Value = 1, },
            RotationMode = Input { Value = 1, },
            AlwaysFaceCamera = Input { Value = 0, },
            Rotation = Input { Value = 1, },
            RotationZ = Input { Value = -90, },
            NewSet10 = Input { Value = 1, },
            Input = Input {
               SourceOp = "BASE_PARTICLES_1_2",
               Source = "Output",
            },
            Style = Input { Value = FuID { "ParticleStyleLine" }, },
            Region = Input { Value = FuID { "CubeRgn" }, },
            ["ParticleStyle.Red"] = Input { Value = 0, },
            ["ParticleStyle.Green"] = Input { Value = 0.507, },
            ["ParticleStyle.Blue"] = Input { Value = 0, },
            ["ParticleStyle.RedLow"] = Input { Value = -0.104, },
            ["ParticleStyle.RedHigh"] = Input { Value = 0.13, },
            ["ParticleStyle.GreenLow"] = Input { Value = 0.052, },
            ["ParticleStyle.GreenHigh"] = Input { Value = 1, },
            ["ParticleStyle.BlueLow"] = Input { Value = -0.195, },
            ["ParticleStyle.BlueHigh"] = Input { Value = 0.299, },
            ["ParticleStyle.AlphaLow"] = Input { Value = -1, },
            ["ParticleStyle.AlphaHigh"] = Input { Value = 1, },
            ["ParticleStyle.Size"] = Input { Value = 25, },
            ["ParticleStyle.SizeVariance"] = Input { Value = 5, },
            ["ParticleStyle.SizeOverLife"] = Input {
               SourceOp = "LASERSizeoverLife",
               Source = "Value",
            },
            ["ParticleStyle.FadeControls"] = Input { Value = 1, },
            ["ParticleStyle.FadeOut"] = Input { Value = 0.546, },
            ["ParticleStyle.MergeControls"] = Input { Value = 1, },
            ["ParticleStyle.BlurOverLife"] = Input {
               SourceOp = "LASERBluroverLife2D",
               Source = "Value",
            },
            ["CubeRgn.Translate.X"] = Input {
               Value = 4.44089209850063e-016,
               Expression = "MASTER_H_WAVE.Transform3DOp.Translate.X",
            },
            ["CubeRgn.Translate.Y"] = Input {
               Value = 0.326465011923907,
               Expression = "MASTERLIFT.Transform3DOp.Translate.Y",
            },
            ["CubeRgn.Width"] = Input { Value = 0.889, },
            ["CubeRgn.Height"] = Input { Value = 0.197, },
            ["CubeRgn.Depth"] = Input { Value = 0.15, }
         },
         ViewInfo = OperatorInfo { Pos = { 687.05, 83.296 } },
      },
      LASERSizeoverLife = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      LASERBluroverLife2D = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0.5, RH = { 0.333333333333333, 0.5 }, Flags = { Linear = true } },
               [1] = { 0.5, LH = { 0.666666666666667, 0.5 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
      },
      pCustom1 = pCustom {
         ID = 11,
         CtrlWZoom = false,
         Inputs = {
            NumberIn1 = Input {
               Value = -7.76998399042972,
               Expression = "Look_At_This_Please.Transform3DOp.Translate.X",
            },
            NumberIn2 = Input {
               SourceOp = "Expression1",
               Source = "NumberResult",
               Expression = "Look_At_This_Please.Transform3DOp.Translate.Y",
            },
            NumberIn3 = Input {
               Value = 0.551362434842657,
               Expression = "Look_At_This_Please.Transform3DOp.Translate.Z",
            },
            Intermediate1 = Input { Value = "n1-px", },
            Intermediate2 = Input { Value = "n2-py", },
            Intermediate3 = Input { Value = "n3-pz", },
            RotationYExpression = Input { Value = "atan2(i1,i3)+90", },
            RotationZExpression = Input { Value = "-atan2(i1,i2)-90", },
            Input = Input {
               SourceOp = "LASER",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 796.05, 83.296 } },
      },
      Expression1 = Expression {
         CtrlWZoom = false,
         Inputs = {
            NumberExpression = Input { Value = "atan(1)", },
         },
      },
      pRender1_1_2 = pRender {
         Inputs = {
            _MotionBlurWarning = Input { Disabled = true, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            OutputMode = Input { Disabled = true, },
            SubFrameCalculationAccuracy = Input { Value = 2, },
            ["MaterialID.MaterialID"] = Input { Value = 2, },
            ["ObjectID.ObjectID"] = Input { Value = 2, },
            Input = Input {
               SourceOp = "pCustom1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1135, 78 } },
      },
      Look_At_This_Please = Shape3D {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 4, },
            ["Transform3DOp.Translate.X"] = Input { Value = -7.76998399042972, },
            ["Transform3DOp.Translate.Y"] = Input { Value = 5.50711110275615, },
            ["Transform3DOp.Translate.Z"] = Input { Value = 0.551362434842657, },
            Shape = Input { Value = FuID { "SurfaceSphereInputs" }, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 3, },
            ["SurfaceSphereInputs.Radius"] = Input { Value = 0.13, },
            ["SurfaceSphereInputs.ObjectID.ObjectID"] = Input { Value = 5, }
         },
         ViewInfo = OperatorInfo { Pos = { 1186.68, -113.074 } },
      },
      Merge3D4_1 = Merge3D {
         Inputs = {
            SceneInput1 = Input {
               SourceOp = "pRender1_1_2",
               Source = "Output",
            },
            SceneInput2 = Input {
               SourceOp = "Look_At_This_Please",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1293, 77 } },
      }
   }
}
www.ablackbirdcalledsue.com
Offline

Okke Verbart

  • Posts: 290
  • Joined: Tue Jan 17, 2017 8:40 pm

Re: Laser simulation: "Look at" rotation expression

PostFri Jan 19, 2018 7:43 am

OK, not quite.... breaking down in some quadrants, but it should be easy to fix this....
www.ablackbirdcalledsue.com
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Re: Laser simulation: "Look at" rotation expression

PostFri Jan 19, 2018 11:29 am

Hey!

I'm a yonki so I kept searching at bed with the notebook till i got slept :lol: and I found that atan2 .

So today I rushed to Fusion to try it, and I've got to the same point you did. In my case, it works perfect in the "north" hemisphere (Y>0) but flips when the target goes south.

The same atan2 function that works seamsless between quadrants for X rotation is not working for Z.

In fact, I had to change sign of one of the operators in the Z formula, because atan2 was returning inversed values. ??? So I re-inverted it in my expression with a "-". But it seems that trick works only in half the quadrants. I need to understand why atan2 returns inversed values instead of forcing it to my desires.

I sinplified a lot the scene for this tests. A cone and a sphere instead of particles, and I've added controls in the cone qith eaasy names to simplify expressions. Even more simplified; I have not implemented differentials. The cone is fixed at 0,0,0. When I solve the ecuator flipping issue I'll implement the required substractions in the atan2 operands.

Edit: how doy you record your shortened code? I'm posting complete comps.
Code: Select all
Composition {
   CurrentTime = 0,
   RenderRange = { 0, 250 },
   GlobalRange = { 0, 250 },
   CurrentID = 16,
   PlaybackUpdateMode = 0,
   Version = "Fusion 9.0.2 build 15",
   SavedOutputs = 0,
   HeldTools = 0,
   DisabledTools = 0,
   LockedTools = 0,
   AudioOffset = 0,
   Resumable = true,
   OutputClips = {
   },
   Tools = {
      Merge3D1 = Merge3D {
         Inputs = {
            SceneInput1 = Input {
               SourceOp = "CONE",
               Source = "Output",
            },
            SceneInput2 = Input {
               SourceOp = "BALL",
               Source = "Output",
            },
            SceneInput3 = Input {
               SourceOp = "center",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1391, 308 } },
      },
      BALL = Shape3D {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 3, },
            ["Transform3DOp.Translate.X"] = Input { Value = -1.29933014877078, },
            ["Transform3DOp.Translate.Y"] = Input { Value = 6.1786235998746, },
            ["Transform3DOp.Translate.Z"] = Input { Value = 3.3805691239199, },
            ["Transform3DOp.Rotation"] = Input { Value = 0, },
            ["Transform3DOp.ScaleNest"] = Input { Value = 0, },
            Shape = Input { Value = FuID { "SurfaceSphereInputs" }, },
            ["MtlStdInputs.Diffuse.Color.Red"] = Input { Value = 0.093, },
            ["MtlStdInputs.Diffuse.Color.Green"] = Input { Value = 0.793, },
            ["MtlStdInputs.Diffuse.Color.Blue"] = Input { Value = 0, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 2, },
            ["SurfaceSphereInputs.Radius"] = Input { Value = 0.3, },
            ["SurfaceSphereInputs.ObjectID.ObjectID"] = Input { Value = 4, }
         },
         ViewInfo = OperatorInfo { Pos = { 1177, 234 } },
      },
      center = Shape3D {
         NameSet = true,
         Inputs = {
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 5, },
            Shape = Input { Value = FuID { "SurfaceCubeInputs" }, },
            ["MtlStdInputs.Diffuse.Color.Green"] = Input { Value = 0.557, },
            ["MtlStdInputs.Diffuse.Color.Blue"] = Input { Value = 0.007, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 3, },
            ["SurfaceCubeInputs.Width"] = Input { Value = 0.34, },
            ["SurfaceCubeInputs.ObjectID.ObjectID"] = Input { Value = 6, }
         },
         ViewInfo = OperatorInfo { Pos = { 1514, 308 } },
      },
      CONE = Shape3D {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 1, },
            ["Transform3DOp.Translation"] = Input { Value = 0, },
            ["Transform3DOp.Rotate.X"] = Input {
               Value = 28.6848116939301,
               Expression = "deg(atan2(BALLZ,BALLY))",
            },
            ["Transform3DOp.Rotate.Z"] = Input {
               Value = 11.8759354167555,
               Expression = "deg(atan2(-BALLX,BALLY))",
            },
            Shape = Input { Value = FuID { "SurfaceConeInputs" }, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 1, },
            ["SurfaceConeInputs.Radius"] = Input { Value = 0.3, },
            ["SurfaceConeInputs.Height"] = Input { Value = 6.28, },
            ["SurfaceConeInputs.ObjectID.ObjectID"] = Input { Value = 2, },
            CONEX = Input { Expression = "Transform3DOp.Translate.X", },
            CONEY = Input { Expression = "Transform3DOp.Translate.Y", },
            CONEZ = Input { Expression = "Transform3DOp.Translate.Z", },
            BALLX = Input {
               Value = -1.29933014877078,
               Expression = "BALL.Transform3DOp.Translate.X",
            },
            BALLY = Input {
               Value = 6.1786235998746,
               Expression = "BALL.Transform3DOp.Translate.Y",
            },
            BALLZ = Input {
               Value = 3.3805691239199,
               Expression = "BALL.Transform3DOp.Translate.Z",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 1175, 302 } },
         UserControls = ordered() {
            CONEX = {
               LINKS_Name = "CONEX",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               INP_MinScale = 0,
               INP_MaxScale = 0,
               INP_MinAllowed = -1000000,
               INP_MaxAllowed = 1000000,
               ICD_Center = 0,
               ICS_ControlPage = "3D"
            },
            CONEY = {
               LINKS_Name = "CONEY",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               ICS_ControlPage = "3D"
            },
            CONEZ = {
               LINKS_Name = "CONEZ",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               ICS_ControlPage = "3D"
            },
            BALLX = {
               LINKS_Name = "BALLX",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               ICS_ControlPage = "3D"
            },
            BALLY = {
               LINKS_Name = "BALLY",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               ICS_ControlPage = "3D"
            },
            BALLZ = {
               LINKS_Name = "BALLZ",
               LINKID_DataType = "Number",
               INPID_InputControl = "SliderControl",
               INP_Integer = false,
               ICS_ControlPage = "3D"
            }
         }
      }
   },
   Views = {
      {
         FrameTypeID = "ChildFrame",
         Mode = 3,
         LayoutPreset = 0,
         Left = 0,
         Top = 27,
         Width = 2560,
         Height = 1272,
         Views = ordered() {
            Main = MultiView {
               Active = "Flow",
               ViewList = ordered() {
                  Flow = "FlowView",
                  Console = "ConsoleView",
                  Timeline = "TimelineView",
                  Spline = "SplineEditorView",
                  Info = "InfoView",
                  Chat = "ChatView"
               },
               Flow = FlowView {
                  Flags = {
                     AutoHideNavigator = true,
                     AutoSnap = true,
                     RemoveRouters = true
                  },
                  NavigatorSize = { 200, 140 },
                  Direction = "Horizontal",
                  PipeStyle = "Direct",
                  Scale = 1,
                  Offset = { -101, -103 }
               },
               Timeline = TimelineView {
                  TreeControlState = {
                  },
                  DisplayMode = "All Tools",
                  ShowCurrentTimeTools = false,
                  Filter = "Show All",
                  ShowSelectedTools = false,
                  ShowAnimatedToolsOnly = false,
                  ShowEditBoxes = false,
                  KeyFrameView = {
                     Position = { Left = 150, Bottom = 327 },
                     ScaleX = 0.536062378167641,
                     OffsetX = -12.8654970760234,
                     OffsetY = 0,
                     AutoScaling = "scroll",
                     AutoSnapTo = "frame",
                     AutoSnapToGuidelines = false,
                     GuidelinesGrabEnabled = true,
                     GuidelinesSnapTo = "frame"
                  },
                  Spreadsheet = { LeftPos = 150, Visible = false }
               },
               Spline = SplineEditorView {
                  LeftPos = 256,
                  ScaleX = 0.2,
                  ScaleY = 0.00338983050847458,
                  OffsetX = 135.2,
                  OffsetY = 0,
                  AutoScaling = "scroll",
                  AutoSnapTo = "frame",
                  AutoSnapToGuidelines = false,
                  GuidelinesSnapTo = "frame",
                  ShowKeyMarkers = false,
                  IndependentHandles = false,
                  ShowNonSplineModifiers = false,
                  GuidelinesGrabEnabled = true,
                  ShowOneToolOnly = false,
                  ShowSelectedTools = false,
                  ShowAllInputs = false,
                  Filter = "Show All"
               },
            },
            Controls = MultiView {
               Active = "Tools",
               ViewList = ordered() {
                  Tools = "ControlView",
                  Modifiers = "ModifierView"
               },
            },
            Left = "PreviewContainer",
            Right = "PreviewContainer",
            Transport = "TransportView",
            Time = "TimeView"
         },
         Layout = {
            Columns = 2,
            RatioX = 1,
            RatioY = 1,
            {
               Rows = 3,
               RatioX = 0.865362035225049,
               RatioY = 97.692125984252,
               {
                  Columns = 2,
                  RatioX = 1,
                  RatioY = 0.71123417721519,
                  { ID = "Left", RatioX = 1, RatioY = 99.8744239631336, Pop = true },
                  { ID = "Right", RatioX = -2, Pop = true },
                  Pop = true
               },
               { ID = "Main", RatioY = 0.242879746835443, Pop = true },
               { ID = "Time", SnapY = 56, Flat = true }
            },
            {
               Rows = 2,
               PixelX = 342,
               { ID = "Controls", RatioX = 1, RatioY = 1 },
               { ID = "Transport", FixedY = -2 }
            }
         }
      }
   },
   Prefs = {
      Comp = {
         Memory = {
            FramesAtOnce = 8,
            Render = {
               SimultaneousBranching = true
            },
         },
         Views = {
            Right = {
               SideB = {
                  PrevCtrlInactiveColor = 4278255360,
                  PickW = 1,
                  PickH = 1,
                  PrevCtrlActiveColor = 4278190335,
                  Viewer = {
                     EnableLUTs = false,
                     LUTPlugin = "FusionViewLUT",
                     NearZ = 0,
                     FitMarginX = 0,
                     FitMarginType = 0,
                     FarZ = -1000,
                     FitMarginY = 0
                  }
               },
               View3D = {
                  CamRight = {
                     Rotation = {
                        Y = -90,
                        X = 0,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  Options = {
                     Lighting = true,
                     Shadows = true
                  },
                  CamLeft = {
                     Rotation = {
                        Y = 90,
                        X = 0,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  CamTop = {
                     Rotation = {
                        Y = 0,
                        X = 90,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  CamPersp = {
                     Rotation = {
                        Y = 261.800018310547,
                        X = 34.5999984741211,
                        Z = 0
                     },
                     Scale = 0.168988853693008,
                     Position = {
                        Y = -1.76909172534943,
                        X = -0.304885655641556,
                        Z = -0.631009519100189
                     }
                  },
                  CamFront = {
                     Rotation = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  CameraName = "Perspective"
               },
            },
            Left = {
               Viewer = {
                  ScaleMode = 1,
               },
               View3D = {
                  CamFront = {
                     Rotation = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  CamLeft = {
                     Rotation = {
                        Y = 90,
                        X = 0,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  CamRight = {
                     Rotation = {
                        Y = -90,
                        X = 0,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  CamPersp = {
                     Rotation = {
                        Y = -79.1999969482422,
                        X = 40.8000030517578,
                        Z = 0
                     },
                     Scale = 0.134141534566879,
                     Position = {
                        Y = -1.13668024539948,
                        X = 0,
                        Z = 0
                     }
                  },
                  CamTop = {
                     Rotation = {
                        Y = 0,
                        X = 90,
                        Z = 0
                     },
                     Scale = 1,
                     Position = {
                        Y = 0,
                        X = 0,
                        Z = 0
                     }
                  },
                  CameraName = "Perspective",
               },
               View2 = {
                  Viewer = {
                     ScaleMode = 1,
                  },
                  View3D = {
                     CamFront = {
                        Rotation = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        },
                        Scale = 0.175369665026665,
                        Position = {
                           Y = -2.33988428115845,
                           X = 1.37928295135498,
                           Z = 0
                        }
                     },
                     CamLeft = {
                        Rotation = {
                           Y = 90,
                           X = 0,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamRight = {
                        Rotation = {
                           Y = -90,
                           X = 0,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamPersp = {
                        Rotation = {
                           Y = 0,
                           X = 30,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamTop = {
                        Rotation = {
                           Y = 0,
                           X = 90,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CameraName = "Front",
                  }
               },
               View3 = {
                  Viewer = {
                     ScaleMode = 1,
                  },
                  View3D = {
                     CamFront = {
                        Rotation = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamLeft = {
                        Rotation = {
                           Y = 90,
                           X = 0,
                           Z = 0
                        },
                        Scale = 0.0944047570228577,
                        Position = {
                           Y = -1.87039089202881,
                           X = 0,
                           Z = -0
                        }
                     },
                     CamRight = {
                        Rotation = {
                           Y = -90,
                           X = 0,
                           Z = 0
                        },
                        Scale = 0.175369665026665,
                        Position = {
                           Y = -1.13668024539948,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamPersp = {
                        Rotation = {
                           Y = 0,
                           X = 30,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamTop = {
                        Rotation = {
                           Y = 0,
                           X = 90,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CameraName = "Left",
                  }
               },
               SideB = {
                  PrevCtrlInactiveColor = 4278255360,
                  PickW = 1,
                  PickH = 1,
                  PrevCtrlActiveColor = 4278190335,
                  Viewer = {
                     EnableLUTs = false,
                     LUTPlugin = "FusionViewLUT",
                     NearZ = 0,
                     FitMarginX = 0,
                     FitMarginType = 0,
                     FarZ = -1000,
                     FitMarginY = 0
                  }
               },
               View1 = {
                  Viewer = {
                     ScaleMode = 1,
                  },
                  View3D = {
                     CamRight = {
                        Rotation = {
                           Y = -90,
                           X = 0,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     Options = {
                        Lighting = true,
                        Shadows = true,
                     },
                     CamLeft = {
                        Rotation = {
                           Y = 90,
                           X = 0,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamTop = {
                        Rotation = {
                           Y = 0,
                           X = 90,
                           Z = 0
                        },
                        Scale = 0.108211673796177,
                        Position = {
                           Y = -2.60459813716807e-008,
                           X = 4.46510314941406,
                           Z = -0.595863103866577
                        }
                     },
                     CamPersp = {
                        Rotation = {
                           Y = 0,
                           X = 30,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CamFront = {
                        Rotation = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        },
                        Scale = 1,
                        Position = {
                           Y = 0,
                           X = 0,
                           Z = 0
                        }
                     },
                     CameraName = "Top",
                  }
               },
               QuadView = true,
            },
            View1 = {
               PrevCtrlInactiveColor = 0,
               PickW = 0,
               PickH = 0,
               PrevCtrlActiveColor = 0,
               SideB = {
                  PrevCtrlInactiveColor = 4278255360,
                  PickW = 1,
                  PickH = 1,
                  PrevCtrlActiveColor = 4278190335,
                  Viewer = {
                     EnableLUTs = false,
                     LUTPlugin = "FusionViewLUT",
                     NearZ = 0,
                     FitMarginX = 0,
                     FitMarginType = 0,
                     FarZ = -1000,
                     FitMarginY = 0
                  }
               }
            },
         },
         FrameFormat = {
            Rate = 25,
            GuideRatio = 1.77777777777778,
         },
         LastFile = "R:\\_Stealth Key III\\max\\LLave mapeada y colocada_centimetros sin smooth.FBX",
         Unsorted = {
            GlobalEnd = 250
         },
         AVI = {
            Saver = {
               Handler = 1196444237,
            }
         },
         Paths = {
         },
         QuickTime = {
            Compressor = "DNxHD HQ 1080p 8bit_AVdn",
         },
      }
   }
}

 
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Re: Laser simulation: "Look at" rotation expression

PostFri Jan 19, 2018 12:41 pm

Realized I dont need it to work in all quadrants for my project. My simulated laser cannon is always over the target, so I've implemented the formula to pCustom rotation instead of that cone.

Just needed to add X,Y,Z offset of the cannon to n1,n2,n3 and then

x rotation=atan2(n3-px,n2-py)
z rotation=-atan2(n1-px,n2-py)

It works! (note the sign inversion for the z rotation).

Btw, the atan2 function returns radians when used in direct expressions, but returns degrees in the pCustom particle rotation expression.

I cann go on with my project, but keep wondering why atan2 returns the oposite sign values in one axis but the "right" ones in the other. I suspect it's connected to the flip issue.

Thanks everyone!
Offline

Okke Verbart

  • Posts: 290
  • Joined: Tue Jan 17, 2017 8:40 pm

Re: Laser simulation: "Look at" rotation expression

PostFri Jan 19, 2018 12:55 pm

good stuff!

BTW, re radians and degrees...see the earlier post: there's a difference between the Numbers Tab (radians), Particles Tab (degrees) and Expression Modifier (degrees)
www.ablackbirdcalledsue.com
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Re: Laser simulation: "Look at" rotation expression

PostTue Jan 23, 2018 12:05 am

I've reached again this dead-end (for me).

I'm trying to finish my CraneCameraRig with the last important feature: Do proper pan while in target mode.

I mean; the Rig I already have can switch between:
-Normal mode (with pan and tilt controls)
-Targeted mode (follows an object, and the pan/tilt controllers become offsets to adjust framing.).

It works but, when in target mode, the pan is bad because the pan head is tilted.

Again, I need to build my own "look at" function. And this time I need it to work in the four quadrants.

My problem:

- If I set an expression for X-rotation atan2(y'-y,z'-z) Works perfect in all quadrants.
- If set the expression to Z-Rotation atan2(x'-x,z'-z) Perfect Z tracking all around too.


But, if I set both expressions simultaneously, it seems one value is perturbing the other and does not solve the quadrant change any more.


Note: due to rig construction, instead of ponting the Z axis to the target, I'm poniting Y, but that's not relevant.


This is a minimal scene containing the problem:

Code: Select all
{
   Tools = ordered() {
      helper = Shape3D {
         NameSet = true,
         Inputs = {
            ["Transform3DOp.Translate.Z"] = Input {
               Value = -5,
               Expression = "-SurfaceCylinderInputs.Height/2",
            },
            ["Transform3DOp.Rotate.X"] = Input { Value = 90, },
            Shape = Input { Value = FuID { "SurfaceCylinderInputs" }, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 3, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 4, },
            ["SurfaceCylinderInputs.Radius"] = Input { Value = 0.04, },
            ["SurfaceCylinderInputs.Height"] = Input { Value = 10, },
            ["SurfaceCylinderInputs.SubdivisionLevelBase"] = Input { Value = 3, },
            ["SurfaceCylinderInputs.ObjectID.ObjectID"] = Input { Value = 5, }
         },
         ViewInfo = OperatorInfo { Pos = { 853, 260 } },
      },
      TARGET_MOVETHIS = Shape3D {
         NameSet = true,
         Inputs = {
            ["Transform3DOp.Translate.X"] = Input { Value = -6.47769075517161, },
            ["Transform3DOp.Translate.Y"] = Input { Value = 3.58967256230106, },
            ["Transform3DOp.Translate.Z"] = Input { Value = -2.49235762543579, },
            Shape = Input { Value = FuID { "SurfaceSphereInputs" }, },
            ["MtlStdInputs.MaterialID"] = Input { Value = 1, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 1, },
            ["SurfaceSphereInputs.Radius"] = Input { Value = 0.34, },
            ["SurfaceSphereInputs.ObjectID.ObjectID"] = Input { Value = 3, }
         },
         ViewInfo = OperatorInfo { Pos = { 1082, 202 } },
      },
      CAM_MOVETHIS = Shape3D {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            SceneInput = Input {
               SourceOp = "helper",
               Source = "Output",
            },
            ["Transform3DOp.Translate.X"] = Input { Value = -8.27141386342268, },
            ["Transform3DOp.Translate.Y"] = Input { Value = 1.7791611753255, },
            ["Transform3DOp.Translate.Z"] = Input { Value = -0.0633333150819293, },
            ["Transform3DOp.Rotate.X"] = Input {
               SourceOp = "Expression2",
               Source = "NumberResult",
            },
            ["Transform3DOp.Rotate.Y"] = Input {
               SourceOp = "Expression1",
               Source = "NumberResult",
            },
            ["MtlStdInputs.MaterialID"] = Input { Value = 2, },
            ["SurfacePlaneInputs.ObjectID.ObjectID"] = Input { Value = 2, }
         },
         ViewInfo = OperatorInfo { Pos = { 854, 306 } },
      },
      Expression2 = Expression {
         CtrlWZoom = false,
         NameSet = true,
         Inputs = {
            n1 = Input {
               Value = -8.27141386342268,
               Expression = "CAM_MOVETHIS.Transform3DOp.Translate.X",
            },
            n2 = Input {
               Value = 1.7791611753255,
               Expression = "CAM_MOVETHIS.Transform3DOp.Translate.Y",
            },
            n3 = Input {
               Value = -0.0633333150819293,
               Expression = "CAM_MOVETHIS.Transform3DOp.Translate.Z",
            },
            n4 = Input {
               Value = -6.47769075517161,
               Expression = "TARGET_MOVETHIS.Transform3DOp.Translate.X",
            },
            n5 = Input {
               Value = 3.58967256230106,
               Expression = "TARGET_MOVETHIS.Transform3DOp.Translate.Y",
            },
            n6 = Input {
               Value = -2.49235762543579,
               Expression = "TARGET_MOVETHIS.Transform3DOp.Translate.Z",
            },
            n7 = Input { Value = -3.41628771292701, },
            NumberExpression = Input { Value = "atan2(n5-n2,n6-n3)", },
            NumberControls = Input { Value = 1, },
            NameforNumber1 = Input { Value = "plate X", },
            NameforNumber2 = Input { Value = "plate Y", },
            NameforNumber3 = Input { Value = "plate Z", },
            NameforNumber4 = Input { Value = "T X", },
            NameforNumber5 = Input { Value = "T Y", },
            NameforNumber6 = Input { Value = "T Z", },
         },
      },
      Expression1 = Expression {
         CtrlWZoom = false,
         Inputs = {
            n1 = Input {
               Value = -8.27141386342268,
               Expression = "CAM_MOVETHIS.Transform3DOp.Translate.X",
            },
            n2 = Input {
               Value = 1.7791611753255,
               Expression = "CAM_MOVETHIS.Transform3DOp.Translate.Y",
            },
            n3 = Input {
               Value = -0.0633333150819293,
               Expression = "CAM_MOVETHIS.Transform3DOp.Translate.Z",
            },
            n4 = Input {
               Value = -6.47769075517161,
               Expression = "TARGET_MOVETHIS.Transform3DOp.Translate.X",
            },
            n5 = Input {
               Value = 3.58967256230106,
               Expression = "TARGET_MOVETHIS.Transform3DOp.Translate.Y",
            },
            n6 = Input {
               Value = -2.49235762543579,
               Expression = "TARGET_MOVETHIS.Transform3DOp.Translate.Z",
            },
            n7 = Input { Value = -3.41628771292701, },
            NumberExpression = Input { Value = "180+atan2(n4-n1,n6-n3)", },
            NumberControls = Input { Value = 1, },
            NameforNumber1 = Input { Value = "plate X", },
            NameforNumber2 = Input { Value = "plate Y", },
            NameforNumber3 = Input { Value = "plate Z", },
            NameforNumber4 = Input { Value = "T X", },
            NameforNumber5 = Input { Value = "T Y", },
            NameforNumber6 = Input { Value = "T Z", },
         },
      },
      Merge3D1 = Merge3D {
         Inputs = {
            SceneInput1 = Input {
               SourceOp = "TARGET_MOVETHIS",
               Source = "Output",
            },
            SceneInput2 = Input {
               SourceOp = "CAM_MOVETHIS",
               Source = "Output",
            },
            SceneInput3 = Input {
               SourceOp = "zero",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1102, 307 } },
      },
      zero = Text3D {
         NameSet = true,
         Inputs = {
            Size = Input { Value = 0.51, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input { Value = "0,0,0", },
            Style = Input { Value = "Bold", },
            Extrusion = Input { Value = 1, },
            ExtrusionProfile = Input {
               SourceOp = "zeroExtrusionProfile",
               Source = "Value",
            },
            ExtrusionDepth = Input { Value = 0.1514, },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 1229, 307 } },
      },
      zeroExtrusionProfile = LUTBezier {
         KeyColorSplines = {
            [0] = {
               [0] = { 0, RH = { 0.0196116135138184, 0.098058067569092 }, Flags = { Linear = true } },
               [0.2] = { 1, LH = { 0.180388386486182, 0.901941932430908 }, RH = { 0.3, 1 }, Flags = { Linear = true } },
               [0.8] = { 1, LH = { 0.7, 1 }, RH = { 0.819611613513818, 0.901941932430908 }, Flags = { Linear = true } },
               [1] = { 0, LH = { 0.980388386486182, 0.098058067569092 }, Flags = { Linear = true } }
            }
         },
         SplineColor = { Red = 192, Green = 128, Blue = 64 },
         NameSet = true,
      }
   }
}


Any help?
Offline

Ignacio de La Cierva

  • Posts: 163
  • Joined: Tue Apr 26, 2016 12:20 pm

Re: Laser simulation: "Look at" rotation expression

PostWed Jan 24, 2018 12:20 am

Okke, friends, yesterday I opened a thread at WeSucKLess, asking for help on these issues.

https://www.steakunderwater.com/wesuckl ... f=6&t=1821


My Crane Rig project caught some attention there, and I'll need a lot of help with the bouncing/overshooting automation expressions also, so I'll hold a kind of development blog in that thread.

Bryan is around also.

Anyway, I'll post here the most relevant issues and, of course, share the Rig once finished.

It'll be slow. I can only dedicate a couple of hours a day to that investigations, not every day.

The big unsolved (but nice workaround) keeps the same:

HOW TO CALCULATE THE ANGLES FORMED BY A GIVEN VECTOR. i.e. "how t program a Look-At controller emulating the Fusion¡s embedded one. It can't be so difficult! I supposed that would be a classic-every-day-use expression... :o

Return to Fusion

Who is online

Users browsing this forum: No registered users and 31 guests