TrackLight moves node to position of light of given name. For SpotLight, copies entire Pose. Does not work for Ambient light which has no position information.
(lightName string)
| 287 | // For SpotLight, copies entire Pose. Does not work for Ambient light |
| 288 | // which has no position information. |
| 289 | func (nb *NodeBase) TrackLight(lightName string) error { |
| 290 | lt, ok := nb.Scene.Lights.ValueByKeyTry(lightName) |
| 291 | if !ok { |
| 292 | return fmt.Errorf("xyz Node: %v TrackLight named: %v not found", nb.Path(), lightName) |
| 293 | } |
| 294 | switch l := lt.(type) { |
| 295 | case *DirLight: |
| 296 | nb.Pose.Pos = l.Pos |
| 297 | case *PointLight: |
| 298 | nb.Pose.Pos = l.Pos |
| 299 | case *SpotLight: |
| 300 | nb.Pose.CopyFrom(&l.Pose) |
| 301 | } |
| 302 | return nil |
| 303 | } |
nothing calls this directly
no test coverage detected