Super Look At

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Super Look At // The Garage

1  |  

Post by Délé // Nov 4, 2006, 10:05pm

Délé
Total Posts: 1374
pic
Ok guys, I finally cracked it. :D My head hurts. :p


I've heard people specifically request this tool (myself included) so I'm hoping that you guys like it. The "Super Look At" is a look at tool with customizable constraints.


I was hoping to make it easier to hook up, but it does take a small amount of work. I will post a mini tut to show how to prepare your object and hook it up below.


There are two axis constraints on the Super look At. One to control the Yaw of the "Looker" object, and one to control the Pitch. I discovered that only two axis rotations are needed to make one object look at another. The Yaw can rotate 360 degrees. The Pitch only rotates a maximum of 180 degrees. If you have the Yaw min set to 0, Yaw max set to 360, Pitch min set to 0, and the Pitch max set to 180, the Super Look At will operate the same as the regular look at.


Here's a couple of tips about the constraints:


Yaw constraints - The min/max Yaw constraints can both go from 0 to 360 degrees. You can set the max higher then the min OR the min higher then the max. This will allow for all possible constraint angles. If the min and max are the same, it will interpret that as having no constraints.


Pitch constraints - The min/max Pitch constraints can go from 0 to 180 degrees. Since there is only 180 degrees of rotation needed for the Pitch, the min MUST be smaller then the max. If the min is equal to or larger then the max, it will act as a lock. So for instance, if you have the min and max values both set to 45 degrees, the pitch will remain at 45 degrees at all times.


Be aware that there is a backtracking algorithm when the Target is out of the constraint range. So the Looker object will backtrack to meet the target at the other side of the constraints. This is normal operating behavior and is necessary to make constraints work.


There is an example of how to hook up an object in the scene below. You can save the SLA (super look at) script to your object library.

Post by Délé // Nov 4, 2006, 10:26pm

Délé
Total Posts: 1374
pic
Ok, here's how to prepare your "looker" object. You may have noticed that there is only world coordinates in the LE. I found a little trick to get object coordinates. That's why this setup process is necessary.


First select the object you want to be the "looker" in the LE. Then select the "encapsulate in 3d" button.


2854


Name your encapsulate container to whatever you want. All this is doing is putting your object into a container (kind of like grouping it with itself).


2855


Both the original object AND the encapsulation have their own axis. Make sure that the axis for your object, and the axis for the encapsulation share the exact same location and rotation.


2853



Now go inside of your new encapsulate node by selecting the orange triangle. Expand the matrix of your original object inside and export the "roll".


2856


Move back out to the scene level. Now your object should have the "roll" on the outer node. It's now ready to hook up to the SLA script.


2857

Post by Délé // Nov 4, 2006, 10:28pm

Délé
Total Posts: 1374
pic
Now expand the matrix of the outer node. Link the "Wld Matrix" of the looker object into the Looker input on the SLA script. Link your Targets "Wld Matrix" to the Target input on the SLA script. Link the "Yaw" output from the SLA script to the "Yaw" input on the expanded matrix of the outer node. Link the "Pitch" output from the SLA script to the "Roll" input that you exported to the outside of the node.

2858

You should be ready to go. I know it's a little goofy, sorry I couldn't make it easier. I'll work on maybe making a macro to hook it up quickly. Or if one of you other guys wants to do that, feel free. I have a couple of side scripts that I want to write for it too. Not sure how long those will take me to write though. :)

Let me know if you have trouble hooking it up. I'll try to answer any questions. Also, please let me know if you find any glitches or have any suggested improvements.

Post by Johny // Nov 5, 2006, 5:11am

Johny
Total Posts: 672
pic
Nice works Délé.

Délé, I found it's not work well with negatif target Z position. You can try it by move target obj to below ground.

Post by Délé // Nov 5, 2006, 9:17am

Délé
Total Posts: 1374
pic
Thanks Johny. :)


I tried it with the target below ground and it works for me. I also tried it with both objects below ground. Could you please post a scene file with it not working so I can take a look?

Post by Saul // Nov 5, 2006, 9:36am

Saul
Total Posts: 32
Hi Dele

This is nice.

I cant get it to work with camera object, maybe 'cos camera dont have axis? Well it must have but i cant get it to align with encapsulator.

Also moving target works as expected but moving the looker has no effect and then translate of target moves looker back to origin.

Here is camera rig that would be good to build and expand upon:

http://www.ailerondesign.com/Saul/18.AVI

Post by trueBlue // Nov 5, 2006, 9:50am

trueBlue
Total Posts: 1761
pic
All right Dele! You never cease to amaze me with your ideas and mathematical solutions. All I need now is some ammo for the Looker and I can be a Marksman.

Post by Délé // Nov 5, 2006, 10:06am

Délé
Total Posts: 1374
pic
Thanks Guys. :)

Saul: Thanks. I suspect that maybe you are trying to move the original Looker object, not the whole encapsulation? The only way to move the looker object is numerically from the expanded matrix in the LE. You must enter your own tx, ty, and tz numerical input. I was thinking of tweaking the script so that you can just link it back into the matrix instead of into the yaw so that you can grab the looker and move it around as usual. I'll see what I can do. :)

As for the camera. It is a little more tricky, but I found that if you zero out the camera, then you can just zero out the encapsulator axis. Then are the same. I did find that you have to set the yaw in the inside original camera object to 180. I've attached a scene with the super look at hooked up to a camera.

Post by trueBlue // Nov 5, 2006, 10:13am

trueBlue
Total Posts: 1761
pic
Hello Dele: I just noticed in your example Looker, the Axis rotation is different then the Encaps one.

Post by Délé // Nov 5, 2006, 10:35am

Délé
Total Posts: 1374
pic
trueBlue: Yeah, they will both be different after you start moving stuff around. The important thing is that they are the same when you hook everything up. So if you zero out the matrix for both the encapsulator and the original "inside" object, the axis should then be the same.

Post by Délé // Nov 5, 2006, 11:33am

Délé
Total Posts: 1374
pic
I was thinking of tweaking the script so that you can just link it back into the matrix instead of into the yaw so that you can grab the looker and move it around as usual.I tried having it so that you can link the matrix directly back into the looker, but unfortunately found out that you still can't move the looker with the widget. It seems that linking anything into the matrix (whether expanded or not) locks the location.

I did come up with a pretty easy work around though. You can create a dummy object with it's scale values set to zero so that it is invisible. Then just expand the wld matrix output for it, and link the tx, ty, and tz location values into the expanded matrix of your looker object. Like in the image below. Then when you want to move the Looker, you just select the dummy object in the LE and it will work like normal. :)

Here is a scene that shows how to hook up a dummy controller for the Looker:
2865

Post by Johny // Nov 5, 2006, 12:13pm

Johny
Total Posts: 672
pic
I tried it with the target below ground and it works for me. I also tried it with both objects below ground. Could you please post a scene file with it not working so I can take a look?

It's work well after I reload the scene file.

Post by Délé // Nov 5, 2006, 4:05pm

Délé
Total Posts: 1374
pic
Cool, that's good to hear. Thanks for checking Johny. :)

Post by SteveBe // Nov 5, 2006, 9:25pm

SteveBe
Total Posts: 282
pic
Thanks Délé!:banana:

Post by Délé // Nov 6, 2006, 10:34am

Délé
Total Posts: 1374
pic
No prob Steve. :)


I hope it proves useful. It should work really good for gun turrets I would think.

Post by Alien // Nov 12, 2006, 6:19pm

Alien
Total Posts: 1231
pic
Here is camera rig that would be good to build and expand upon:

http://www.ailerondesign.com/Saul/18.AVI

In case anyone else doesn't have the codec used for that file installed, you can get it here:

http://www.techsmith.com/download/codecs.asp

Post by trueBlue // Nov 21, 2006, 11:16am

trueBlue
Total Posts: 1761
pic
I tried having it so that you can link the matrix directly back into the looker, but unfortunately found out that you still can't move the looker with the widget. It seems that linking anything into the matrix (whether expanded or not) locks the location.

I did come up with a pretty easy work around though. You can create a dummy object with it's scale values set to zero so that it is invisible. Then just expand the wld matrix output for it, and link the tx, ty, and tz location values into the expanded matrix of your looker object. Like in the image below. Then when you want to move the Looker, you just select the dummy object in the LE and it will work like normal. :)

I discovered a different solution for the above. Encapsulate in 3D the Looker object. Now go inside and Expand the Matrix and Export the Yaw of the Expanded Matrix and the Roll of the WildLooker. Then hook up the Roll and Yaw to the SLA script panel.
Also works for the Camera too!

Post by Délé // Dec 13, 2006, 12:55pm

Délé
Total Posts: 1374
pic
I made a little demo video for the SLA script. It's nothing real fancy or anything. It just shows a gun setup with constraints. I was mostly testing to see if it would transfer to keyframes ok. I guess I also wanted to see how my new audio software works too. :)


Anyway, I thought I might as well post it.


SLA Demo (13.1mb) (http://www.deledesigns.com/images/Gallery/animations/SLAdemo.mov)


3409
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn