Constrain and Point

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.

Constrain and Point // Scriptorium

1  |  

Post by jamesmc // Dec 26, 2007, 6:52pm

jamesmc
Total Posts: 2566
Looking for equivalents in scripting for constrain and point at, that is if there are any.

Purpose of constrain is to constrain an object to certain axis (X,Y,Z)

Purpose of point at is so that an object looks at an object when it translates in the x,y or z axis.

Sort of like the dummy target in proc anim video, but as a script device.

Would the current controllers dialogs in the proc anim course substitute for this feature.

My goal would be able to have an object rotate in one axis with a relocated pivot look at an second object that is causing a third object to rotate.

See the discussion in the tech forum on the piston.
http://forums1.caligari.com/truespace/showpost.php?p=56477&postcount=2

Working with similar parameters as described in the flash file.

Post by Délé // Dec 27, 2007, 5:43pm

Délé
Total Posts: 1374
pic
Well, you can create a "look at" tool by hand. It's more difficult in 3 axes, but 2 axes is easy. It's probably a lot easier to just use the built in look at tool though.


If you are interested in learning how to calculate angles though, I'll attach a simple scene. It has a script that makes a looker object look at a target object. It is only for the X and Y axis though. The watchdog event triggers the script to execute whenever one of the two objects is moved. I have the script commented to explain what each part is doing.


First you have to calculate the displacement between the two objects for each of the two axes. Then you calculate the angle in radians. Then you have to convert the radians to degrees.


It's not too difficult but the look at tool in tS would be faster and easier.


As for the constraints, I guess you could keep an object locked in a certain location if you want by assigning a value to lock to. Not sure how that would work with the piston project though.


It may be possible to create the piston without much scripting if at all. You might be able to create two dummy objects on each side of the piston that the rods on each side could look at. The axis for the rods would be at the bottom by the flywheel. The rods could be encapsulated with the flywheel so they move in the circular motion while looking at the dummy objects on each side of the piston.


Not sure if I'm making much sense. This is something that one has to actually get in and try different things to see what works. It's hard to explain scenarios that may or may not work as you think. I'll try to mess around a bit when I get some time if you want.
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