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
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