Away 4.1 : Particles : Advance : Only renders when camera looks at base?

Software: Away3D 4.x

Babylon, Jr. Member
Posted: 16 November 2012 07:07 AM   Total Posts: 39

Greetings,
I’m trying to generate a block world where a character moves around.

You might want to view:
http://bscacad2.buffalostate.edu/~klingeta01/wp/flash/bin-releaseNEWEST/phy13.html

To understand what I’m doing.
[Click start, and arrow keys to move, W A S D to move camera, space to jump]

using concepts from:
http://away3d.com/tutorials/Introduction_to_Particles

I’d like to generate my block world. I’ve got it to add the block peices and have it look as the original in the link above, but you can only view it when you look down.

I believe it has to do with the worldMesh being located below the camera, even though subgeometries are being drawn in view? Thus causing the sub geometries to just not draw in that case?

I’d like however for it to draw those subgeometries. Perhaps if there is a way to always render a certain object regardless of being ‘on screen’?

I don’t know what the best way to go about this is.

When you view this:
http://bscacad2.buffalostate.edu/~klingeta01/wp/flash/bin-releaseNEWEST/phy14.html

Press ‘S’ to look down, and the world generates (I’ve kept the animation from the tutorial). You can only view it in this view point, even if it’s drawing cubes else where.

help please,
-B


EDIT:
::::::::::::::::::::::::
Code:

if (worldArray[x][y][z] == && drawIt && && 126 && && 126 && 2){
       
//if all logic passes to determine a drawn cube, well
       //place it down.
       
       
var point:Vector3D = new Vector3D(000);
       
point.scaleBy(15);
       
data.push(point);
       
      
// place_a_new_cube(x,y,z,0,0,0);

      
for (var i:int 0data.lengthi++)
   
{
    geometrySet
.push(cubeG);
   
}
   
       animati ParticleAnimationSet
();
   
//add behaviors to the animationSet
   
animationSet.addAnimation(new ParticleVelocityNode(ParticlePropertiesMode.LOCAL_STATIC));
   
animationSet.addAnimation(new ParticlePositionNode(ParticlePropertiesMode.LOCAL_STATIC));
   
   
//set the initialiser function
   
animationSet.initParticleFunc initParticleParam;
   
   var 
material:ColorMaterial = new ColorMaterial(0xffffff);
   
material.alphaPremultiplied true;
   
material.lightPicker _lightPicker;
   var 
particleGeometry:Geometry ParticleGeometryHelper.generateGeometry(geometrySet);
  
   
particleMesh = new Mesh(particleGeometryplaneMaterial);
   
animator = new ParticleAnimator(animationSet);
   
particleMesh.animator animator;
   
animator.start();
   
view.scene.addChild(particleMesh); 
private function initParticleParam(prop:ParticleProperties):void
  {
 
   prop[ParticleVelocityNode
.VELOCITY_VECTOR3D] = new Vector3D(Math.sin(degree1) * Math.cos(degree2), Math.cos(degree1) * Math.cos(degree2), Math.sin(degree2));


   
   
prop[ParticlePositionNode.POSITION_VECTOR3D] = new Vector3D(data[prop.index].xdata[prop.index].15data[prop.index].);

   
    
   

Avatar
Cheng Liao, Administrator
Posted: 16 November 2012 07:35 AM   Total Posts: 116   [ # 1 ]

Hi
The particles were culled by bound checking. Because all particles’ positions are entirely calculated on the GPU, there is no way of having the bounds automatically adjust. You can set a large enough bound yourself:

particleMesh.bounds.fromSphere(new Vector3D(), 1000000); 
   

Babylon, Jr. Member
Posted: 19 November 2012 05:05 AM   Total Posts: 39   [ # 2 ]

Thanks so much, this works perfectly for what I wanted to do.

I have another question. When I click on a tutorial it shows me first a pre-loader. How could I begin to create something similar? Is it done in flash?

Edit:::
Poking around it looks like javascript.
If I change the size of my stage by 1 pixel after it loads, could I use javascript to check the size of the div that contains my flash container? So if my game is ‘loaded’ the div will be 1 pixel bigger.. almost unnoticeable.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X