#Align to Camera Script
6 messages in this thread
I have been labouring to develop a script, either in Keyscript or The Script
Extension PXP, align any given object to the view plane of the camera. The
basic approach has been to align a dummy object within the 3DS scene, and then
query the position and rotation of this object within the script. Of course, I
tied myself up in a monumental knot, applying the tranformation matrices – the
documentation is a little thin on how the axis of rotation is modified with
repeated applications of a transform.
Do any of you knowledgable people out there have a script that might guide me
in this problem?
Thanks
Neil McEvoy
Eolas inc.
Kingston, Canada
Hi Neil,
<< The basic approach has been to align a dummy object within the 3DS scene,
and then query the position and rotation of this object within the script. >>
You'll find my version of this puzzle on the "Inside 3ds4" CD-Rom.
'———————————————————–
' CAMTRACK.K3D
' Keeping Objects Perpendicular to a Camera's Position
' An "Inside 3D Studio" utility
' By: Jonas Ruikis
'
' CAMTRACK rotates a selection of objects about their pivot point (of course)
' so their first face is prependicular to a selected Camera's position.
' Axes may be locked for the objects.
' Either the camera and/or the objects may be in motion.
' Respects the current Time Segment
'
' ================================================================
Track this script down and enjoy it..
A few tips.. I had to compute the dot product and the cross product in order to
find the axis and rotation. Also, don't try to create a rotation key on frame
0.
jonas[adesk]
Jonas,
Where does one get your CD?
Will
Hi Will,
<<.. your cd >>
The CD and book contain many contributions from many authors found often in
this forum. My scripts are but a small fraction of it's entire contents.
<<..where can I find "Inside 3ds Release 4" ? >>
Most larger bookstores carry it as well as several dealers. It's published by
New Riders and has a ISBN 1-56205-415-5.
jonas[adesk]
Jonas –
Thanks for the reply about object alignment – and pleased to meet you! I have
the book and CD, and I've already learned a lot from your implementation in
CAMTRACK.
My problem was actually an extension of your program: in addition to rotating
the objects, I wanted to move them to a particular plane parallel to the camera
plane, so I had to calulate some displacements as well. And that's where it
all came off the tracks, so to speak. The displacements seemed to occur in
directions that I didn't expect.
I had trouble getting the new "move" function to work for me. I was able to
use your approach to rotate the object to face the camera. I then tried to
calculate the displacement needed to move the object in the direction of the
vector normal to its front face. With this new vector, and the present
location of the object, I tried to use the "move" function in the PXP Script
Extension. I verified my trigonometry by hand, but somehow, the script didn't
give me the expected results, and I wondered if I was missing some subtlety in
the "move" function.
Any thoughts?
Neil McEvoy
Eolas Inc.
Kingston, Canada..
Hi Neil,
<<.. I tried to use the "move" function in the PXP Script Extension. I
verified my trigonometry by hand, but somehow, the script didn't give me the
expected results, and I wondered if I was missing some subtlety in the "move"
function.
Any thoughts? >>
I would love to see this discussion taken publically to the scripts section.
There are several very good TSE script writers who may wish to review your
work. I however, have not spent considerable time outside of the Script_i.kxp
but would love to follow the discussions of those that join in.
In the mean time, have you taken Phil Miller's Align script into consideration?
File Info for ALIGN.ZIP
Section: Scripts Contributor: 73172,1351 Size: 7825
Submitted: 2/17/95 Type: Binary Accesses: 226
Title: Planet Studio: Align script
Keys: PLANET STUDIO ALIGN K3D SCRIPT PHILLIP MILLER
Align script for Planet Studio. Align one or more objects in the keyframer.
;
;Alignment by Object Bounding Box Extents!;by Phillip Miller
jonas[adesk]