[Papervision3D] Animating camera to target
Ross Sclafani
ross.sclafani at gmail.com
Tue Jun 23 09:41:01 PDT 2009
happy to help.
i use a custom class called SmartPlane instead of Plane
which has width and height properties
i have attached it. enjoy.
On Jun 23, 2009, at 12:33 PM, Eric McConkie wrote:
> Omg! This makes my day! I wish I thought of that. This could be the
> perfect formula. THANKS!
>
> On Jun 23, 2009, at 8:19 AM, Ross Sclafani <ross.sclafani at gmail.com>
> wrote:
>
>> there is no width property of Plane.
>>
>> try the following:
>> function getPlaneWidth(p:Plane){
>> with(p){
>> return (geometry.aabb.maxX - geometry.aabb.minX)*scaleX
>> }
>> }
>> On Jun 23, 2009, at 11:06 AM, montey wrote:
>>
>>>
>>> Thanks Gordon,
>>>
>>> I can't seem to be able to get the width of the evt that was
>>> clicked on. I
>>> set my click event on the plane When I try to do a call like this
>>> it throws
>>> an error.
>>> My plane consists of a bunch of color materials. which are set to
>>> be
>>> interactive = true
>>>
>>> Property width not found on
>>> org.papervision3d.objects.primitives.Plane and
>>> there is no default value.
>>>
>>> private function onPlaneClick( evt : InteractiveScene3DEvent ) :
>>> void
>>> {
>>> //camera.lookAt(evt.target as Plane);
>>> var targetPlane : Plane = evt.target as Plane
>>> trace("evt.target = "+targetPlane.width)
>>> /*var xpos:Number = evt.target.x - evt.target.width/2;
>>> var ypos:Number = evt.target.y - evt.target.height/2;
>>> var zpos:Number = evt.target.z - 100;
>>> TweenMax.to(camera, .8, {x:xpos, y:ypos, z:zpos,
>>> ease:Expo.easeOut});
>>> camera.lookAt(evt.target as Plane);
>>> */
>>>
>>> trace("camera target = "+camera.target);
>>> }
>>>
>>> gordee wrote:
>>>>
>>>>
>>>> If I have understood what you are trying to do, then try this;
>>>> interactiveScene3DEvent.target is the plane clicked on;
>>>>
>>>> var xpos:Number = iS3DEvent.target.x - iS3DEvent.target.width/2;var
>>>> ypos:Number = iScene3DEvent.target.y - iS3DEvent.target.height/2;
>>>> zpos:Number = iScene3DEvent.target.z - 100;
>>>>
>>>> Tweener.addTween(camera, {x:xpos, y:ypos, :z:zpos, time:1});
>>>> hth
>>>>
>>>> Regards
>>>> Gordon Everett
>>>>
>>>> My preferred email address: gordon.everett2 at gmail.com
>>>>
>>>> My Blog: http://flashgordonmedia.blogspot.com/
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Date: Mon, 22 Jun 2009 22:18:15 -0700
>>>>> From: e_account at mac.com
>>>>> To: papervision3D at osflash.org
>>>>> Subject: [Papervision3D] Animating camera to target
>>>>>
>>>>>
>>>>> I have 20 planes positioned with z spacing what I'm trying to do
>>>>> is move
>>>>> the
>>>>> camera through all my planes as the user clicks on each plane.
>>>>> I'm trying
>>>>> to
>>>>> figure out how to do that. I tried setting the camera target to
>>>>> the
>>>>> clicked
>>>>> plane but that didn't work. I just want to tween the camera
>>>>> through each
>>>>> plane like a fly through.
>>>>>
>>>>> Any ideas please.
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Animating-camera-to-target-tp24158838p24158838.html
>>>>> Sent from the Papervision3D mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Papervision3D mailing list
>>>>> Papervision3D at osflash.org
>>>>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>>>
>>>> _________________________________________________________________
>>>> Get the best of MSN on your mobile
>>>> http://clk.atdmt.com/UKM/go/147991039/direct/01/
>>>> _______________________________________________
>>>> Papervision3D mailing list
>>>> Papervision3D at osflash.org
>>>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>>>
>>>>
>>>
>>> --
>>> View this message in context: http://www.nabble.com/Animating-camera-to-target-tp24158838p24167306.html
>>> Sent from the Papervision3D mailing list archive at Nabble.com.
>>>
>>>
>>> _______________________________________________
>>> Papervision3D mailing list
>>> Papervision3D at osflash.org
>>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D at osflash.org
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090623/b6cceea9/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SmartPlane.as
Type: application/octet-stream
Size: 600 bytes
Desc: not available
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090623/b6cceea9/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090623/b6cceea9/attachment-0003.html>
More information about the Papervision3D
mailing list