PDA

View Full Version : Plane transformations


cridalab
06-09-2008, 06:34 PM
hello ECers,

I'm trying to dynamically place a plane on another plane (for a 3D image gallery).
This seems like a common problem so I was wondering if anyone already has a function to achieve it.

The example below usually works for planes that have just been translated but (as expected) not for rotations:

; place picture on base plane by rotating to local coordinate system and then translate to given (x,y,z)
(defun placepic (base pic x y z)
; set picture to base coordinate system
; ...?
; apply transformation by finding offset between current and desired location
(setq location (getobjectlocation pic))
(setanimationvarbydesc pic "Move" "Move Amount X" (- x (nth 0 location)))
(setanimationvarbydesc pic "Move" "Move Amount Y" (- y (nth 1 location)))
(setanimationvarbydesc pic "Move" "Move Amount Z" (- z (nth 2 location)))
(triggeranimation pic "Move")
)
I think I need to set the picture to the same coordinate system as the plane so I tested a few potentially relevant functions (getobjectxyzaxisvector, getobjectaxisoffset, getobjecttransformmatrix, getobjectyawpitchroll) but their values didn't change under rotation.


any advice would be welcomed!
Richard

vertigo
06-09-2008, 07:00 PM
c,

Just to make sure I understand.

(1) You have two planes
(2) First plane is located at X, Y, Z coordinates
(3) The second plane is located at different X, Y, Z coordinates
(4) You want to bring the second plane in alignment with the first plane or the base plane.

Is that correct?

cridalab
06-09-2008, 07:38 PM
yeah that's right, I'm trying to move a picture plane on to a base plane.

Have you done something like this before?
Richard

tilite
06-10-2008, 09:03 PM
cridalab... have you considered using a referenced plane object in conjunction with materials. When you change the original object material the reference will update also.

No longer needing to copy the geometry.

cridalab
06-11-2008, 12:20 AM
if I understand you right, that would require me to statically define the locations but I need everything to be dynamic.

cridalab
06-11-2008, 12:24 AM
I've had a look around the old DC forum and a few people there had trouble with this. For example there is discussion in this thread:
http://www.righthemisphere.com/forum/showthread.php?t=3218&highlight=coordinate+system

Is this kind of fine grained control not possible with EC?

cridalab
06-16-2008, 09:15 PM
in the end I achieved the functionality I wanted. Here are some things I learnt, in case someone else has similar goals:

Avoid mixing dynamic and static content. It creates problems with coordinate systems and offsets.
Split up animations. Moving or rotating along more than 2 axes at once leads to non-deterministic behaviour.
Avoid 'Add to last animation'. It leads to non-deterministic behaviour.
If possible use alterations to move content instead of animations. I found them more reliable.
Use the XY plane. I originally used the XZ plane and couldn't get it working until I switched.