Kevin Burke
2010-10-15 13:58:09 UTC
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?
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.
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.