Discussion:
Why does Papervision hang when I view model from the side?
Kevin Burke
2010-10-15 13:58:09 UTC
Permalink
I have a Papervision plane with an AS3DMod Cloth modifier applied to it. It
runs well when viewed from the front and back, but it trips up for some
reason when viewed from the side?

http://www.kevinburkeportfolio.com/downstream/virgen.swf
http://www.kevinburkeportfolio.com/downstream/virgen.swf

The orbit code has easing applied to it:
private function upHandler(event:Event):void
{
isCameraRotating = false;
mstack=true;
}

private function downHandler(event:Event):void
{
isCameraRotating = true;
mstack=false;
previousMousePoint = new Point(mouseX, mouseY);
dxList = new Vector.();
dyList = new Vector.();
}

private function updateCamera():void
{
cameraYaw %= 360;

cameraPitch %= 360;
cameraPitch = cameraPitch > 0 ? cameraPitch : 0.0001;
cameraPitch = cameraPitch < 180 ? cameraPitch : 179.9999;

//trace("cameraPitch: "+cameraPitch, "cameraYaw: "+cameraYaw);
camera.orbit(cameraPitch, cameraYaw, true, cameraTarget);
}

private function calc(list:Vector., d:Number):Number
{
if(list.length > SMOOTHNESS)
list.shift();
list.push(d);

var result:Number = 0;
for each(var item:Number in list)
result += item;
return result / list.length * SENSITIVITY;
}

private function render(e:Event):void
{
camera.lookAt(cameraTarget);
renderer.renderScene(scene, camera, viewport);

if (mstack)
{
codice.m.apply();
}

if(!isCameraRotating)
return;
if(previousMousePoint.x == mouseX
&& previousMousePoint.y == mouseY)
{
dxList.shift();
dyList.shift();
return;
}

var dx:Number = previousMousePoint.x - mouseX;
var dy:Number = previousMousePoint.y - mouseY;
TweenLite.to(this, 2, {onUpdate:updateCamera, cameraYaw:cameraYaw +
calc(dxList, dx), cameraPitch:cameraPitch + calc(dyList, dy),
ease:Cubic.easeOut, overwrite:true});

previousMousePoint = new Point(mouseX, mouseY);

}

Any ideas?
--
View this message in context: http://papervision3d.758870.n4.nabble.com/Why-does-Papervision-hang-when-I-view-model-from-the-side-tp2997085p2997085.html
Sent from the Papervision3D mailing list archive at Nabble.com.
nir blue
2010-10-17 21:38:47 UTC
Permalink
could it be that the camera pitch should be rounded? maybe its going way to
far after the decimal point.
Post by Kevin Burke
I have a Papervision plane with an AS3DMod Cloth modifier applied to it. It
runs well when viewed from the front and back, but it trips up for some
reason when viewed from the side?
http://www.kevinburkeportfolio.com/downstream/virgen.swf The orbit code
private function upHandler(event:Event):void
{
isCameraRotating = false;
mstack=true;
}
private function downHandler(event:Event):void
{
isCameraRotating = true;
mstack=false;
previousMousePoint = new Point(mouseX, mouseY);
dxList = new Vector.<Number>();
dyList = new Vector.<Number>();
}
private function updateCamera():void
{
cameraYaw %= 360;
cameraPitch %= 360;
cameraPitch = cameraPitch > 0 ? cameraPitch : 0.0001;
cameraPitch = cameraPitch < 180 ? cameraPitch : 179.9999;
//trace("cameraPitch: "+cameraPitch, "cameraYaw: "+cameraYaw);
camera.orbit(cameraPitch, cameraYaw, true, cameraTarget);
}
private function calc(list:Vector.<Number>, d:Number):Number
{
if(list.length > SMOOTHNESS)
list.shift();
list.push(d);
var result:Number = 0;
for each(var item:Number in list)
result += item;
return result / list.length * SENSITIVITY;
}
private function render(e:Event):void
{
camera.lookAt(cameraTarget);
renderer.renderScene(scene, camera, viewport);
if (mstack)
{
codice.m.apply();
}
if(!isCameraRotating)
return;
if(previousMousePoint.x == mouseX
&& previousMousePoint.y == mouseY)
{
dxList.shift();
dyList.shift();
return;
}
var dx:Number = previousMousePoint.x - mouseX;
var dy:Number = previousMousePoint.y - mouseY;
TweenLite.to(this, 2, {onUpdate:updateCamera, cameraYaw:cameraYaw + calc(dxList, dx), cameraPitch:cameraPitch + calc(dyList, dy), ease:Cubic.easeOut, overwrite:true});
previousMousePoint = new Point(mouseX, mouseY);
}
Any ideas?
------------------------------
View this message in context: Why does Papervision hang when I view model
from the side?<http://papervision3d.758870.n4.nabble.com/Why-does-Papervision-hang-when-I-view-model-from-the-side-tp2997085p2997085.html>
Sent from the Papervision3D mailing list archive<http://papervision3d.758870.n4.nabble.com/>at Nabble.com.
_______________________________________________
Papervision3D mailing list
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
Kevin Burke
2010-10-18 13:46:17 UTC
Permalink
Thank you very much for your idea! I'm out of answers and I am still very
unsatisfied because of this bug. I rounded the pitch as you suggested, but that
did not fix the problem. However, I think you might be on to something because I
traced the pitch & yaw of the camera and the 'hanging' behaviour happens when
the yaw is ~0 and ~-90. When the Cloth modifier begins, the behaviour is more
subdued, but as the modifier becomes more pronounced, so does the glitch. I just
don't understand why the rendering stops only at these degrees of yaw? The movie
seems to work fine when I orbit around the modified blanket from other degrees
:-/ ?




________________________________
From: nir blue [via Papervision3D]
<ml-node+2999426-61687223-21963-***@public.gmane.org>
To: Kevin Burke <pajhonka-/***@public.gmane.org>
Sent: Sun, October 17, 2010 4:44:13 PM
Subject: Re: Why does Papervision hang when I view model from the side?

could it be that the camera pitch should be rounded? maybe its going way to far
after the decimal point.



On Fri, Oct 15, 2010 at 6:58 AM, Kevin Burke <[hidden email]> wrote:

I have a Papervision plane with an AS3DMod Cloth modifier applied to it. It runs
well when viewed from the front and back, but it trips up for some reason when
viewed from the side? http://www.kevinburkeportfolio.com/downstream/virgen.swf
private function upHandler(event:Event):void { isCameraRotating = false;
mstack=true; } private function downHandler(event:Event):void {
isCameraRotating = true; mstack=false; previousMousePoint = new
Point(mouseX, mouseY); dxList = new Vector.<Number>(); dyList = new
Vector.<Number>(); } private function updateCamera():void {
cameraYaw %= 360; cameraPitch %= 360; cameraPitch = cameraPitch > 0
"+cameraYaw); camera.orbit(cameraPitch, cameraYaw, true, cameraTarget); }
private function calc(list:Vector.<Number>, d:Number):Number {
if(list.length > SMOOTHNESS) list.shift(); list.push(d); var
result:Number = 0; for each(var item:Number in list) result += item;
return result / list.length * SENSITIVITY; } private function
render(e:Event):void { camera.lookAt(cameraTarget);
renderer.renderScene(scene, camera, viewport); if (mstack) {
codice.m.apply(); } if(!isCameraRotating) return;
if(previousMousePoint.x == mouseX && previousMousePoint.y == mouseY) {
dxList.shift(); dyList.shift(); return; } var dx:Number =
previousMousePoint.x - mouseX; var dy:Number = previousMousePoint.y - mouseY;
TweenLite.to(this, 2, {onUpdate:updateCamera, cameraYaw:cameraYaw +
calc(dxList, dx), cameraPitch:cameraPitch + calc(dyList, dy),
ease:Cubic.easeOut, overwrite:true}); previousMousePoint = new
Point(mouseX, mouseY); }
Any ideas?
________________________________
View this message in context: Why does Papervision hang when I view model from
the side?
Sent from the Papervision3D mailing list archive at Nabble.com.
_______________________________________________
Papervision3D mailing list
[hidden email]
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
_______________________________________________
Papervision3D mailing list
[hidden email]
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


________________________________

View message @
http://papervision3d.758870.n4.nabble.com/Why-does-Papervision-hang-when-I-view-model-from-the-side-tp2997085p2999426.html

To unsubscribe from Why does Papervision hang when I view model from the side?,
click here.
--
View this message in context: http://papervision3d.758870.n4.nabble.com/Why-does-Papervision-hang-when-I-view-model-from-the-side-tp2997085p3000271.html
Sent from the Papervision3D mailing list archive at Nabble.com.
Loading...