Fix for Unofficial UnLookAt function

Post Reply
clintonman
Captain
Posts: 2750
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Fix for Unofficial UnLookAt function

Post by clintonman » 01 Mar 2014, 18:08

I just discovered that the Unlookat does not work for lights. Attached is a fix for the 7.61 Unofficial Update version of truespace.

On a side note I also discovered that when you use lookat with a light it may not work if it is a new light with the default orientation. Rotate it a little bit before lookat and it works.
Attachments
UnLookAt Fix.zip
(8.14 KiB) Downloaded 82 times
Clinton Reese

http://clintons3d.com

User avatar
trueBlue
Captain
Posts: 1993
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue » 02 Mar 2014, 01:27

Thanks Clinton! I guess nobody has used the LookAt tool on lights since hummmmm...2009?
Would you mind using your script that is created in tS76 so that it is compatible with tS76 too?
Also it is necessary to include the xml file so that when you reset the default context the script is rebuilt.
You can overwrite it in:
C:\trueSpace76\tS\Scripts\ScriptCommands\UnLookAt.xml
Both files created in tS76 included here and are compatible with tS761.

One way a user could install this would be to replace the UnLookAt.xml file in tS76 or tS761 and then reset the default context. No need to replace the UnLookAt.RsObj in System/Scripts/Commands
Attachments
UnLookAt_tS76.zip
(2.97 KiB) Downloaded 77 times

User avatar
Draise
Captain
Posts: 3073
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Fix for Unofficial UnLookAt function

Post by Draise » 02 Mar 2014, 01:49

I've used it before... wondered why they didn't' work quite as expected!!!

clintonman
Captain
Posts: 2750
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Fix for Unofficial UnLookAt function

Post by clintonman » 08 Mar 2014, 21:48

I stuck an installer script on my utilities page:
http://www.clintons3d.com/plugins/trues ... index.html" onclick="window.open(this.href);return false;

Installation steps:

unzip the file
load the rsobj script and run it

the script will install and the xml file will copy to the scripts folder
Clinton Reese

http://clintons3d.com

User avatar
trueBlue
Captain
Posts: 1993
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Fix for Unofficial UnLookAt function

Post by trueBlue » 12 Aug 2019, 13:52

Added Model lights

Code: Select all

function Execute(params)
{
if (Node.ConExists(Node.FirstSelected(), "WldMatrix"))
{
Node.Value(Node.FirstSelected(),"Matrix") = Node.Value(Node.FirstSelected(),"WldMatrix");
Node.ConRemove(Node.Selection(), "Target Matrix");
Node.ConnectTo(Node.Selection() + "/Transform", "WldMatrix", Node.Selection(), "WldMatrix");
Node.ConnectTo(Node.Selection() + "/Transform", "ObjMatrix", Node.Selection(), "ObjMatrix");
Node.Delete(Node.Selection() + "/LookAt2");
Node.Delete(Node.Selection() + "/LookAt2");
Node.Delete(Node.Selection() + "/LookAt2, 1");
Node.Delete(Node.Selection() + "/LookAt2, 2");
Node.Delete(Node.Selection() + "/LookAt2, 3");
Node.Delete(Node.Selection() + "/LookAt2, 4");
if(Node.Exists(Node.FirstSelected() + "/DirlightShader"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/DirlightShader", "Input_position");
else if(Node.Exists(Node.FirstSelected() + "/Infinite Preferences"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/Infinite Preferences", "Input_position");
else if(Node.Exists(Node.FirstSelected() + "/Spot Preferences"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/Spot Preferences", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/SpotlightShader"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/SpotlightShader", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/Projector Preferences"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/Projector Preferences", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/SpotlightShader"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/SpotlightShader", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/Directional Preferences"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/Directional Preferences", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/Area Preferences"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/Area Preferences", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/AreaLight"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/AreaLight", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/LocalLight"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/LocalLight", "In Matrix");
else if(Node.Exists(Node.FirstSelected() + "/Omni Preferences"))
	Node.ConnectTo(Node.FirstSelected() + "/Transform", "WldMatrix", Node.FirstSelected() + "/Omni Preferences", "In Matrix");
}
}

clintonman
Captain
Posts: 2750
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Fix for Unofficial UnLookAt function

Post by clintonman » 12 Aug 2019, 16:22

trueBlue wrote:
12 Aug 2019, 13:52
Added Model lights
...
Nice.
I did some tests and workspace look at doesn't work properly for modelspace lights. They point in the opposite direction.
Attached is an updated installer for your convenience.

The original installer was moved to the obsolete section of my site.
http://www.clintons3d.com/plugins/trues ... index.html

"Unzip and load the script from the file menu and run it from the link editor. If the script is not loaded from the file menu then the change will be lost on the next reset to the default context."
Attachments
UnlookAtInstall.zip
(9.66 KiB) Downloaded 11 times
Clinton Reese

http://clintons3d.com

Post Reply