Game Development Reference
In-Depth Information
// Set Initial Position and Orientation
Vector3 Axis = new Vector3(0,1,0);
Vector3 Position = new Vector3(0.0f, 0.0f, 0.0f);
Vector3 Scale = new Vector3(0.25f,0.30f,0.25f);
m_Pyramid.m_Orientation.SetPosition(Position);
m_Pyramid.m_Orientation.SetRotationAxis(Axis);
m_Pyramid.m_Orientation.SetScale(Scale);
m_Pyramid.m_Orientation.AddRotation(45);
m_Pyramid.GetObjectPhysics().SetGravity(false);
Vector3 ColorGrid = new Vector3(1.0f, 0.0f, 0.5f);
m_Pyramid.SetGridSpotLightColor(ColorGrid);
m_Pyramid.GetObjectPhysics().SetMassEffectiveRadius(7);
m_Pyramid.GetObjectPhysics().SetMass(2000);
//SFX
m_Pyramid.CreateExplosionSFX(m_SoundPool, R.raw.explosion2);
m_Pyramid.SetSFXOnOff(true);
// Create Explosion
int NumberParticles = 20;
Vector3 Color = new Vector3(1,1,0);
long ParticleLifeSpan = 2000;
boolean RandomColors = false;
boolean ColorAnimation = true;
float FadeDelta = 0.001f;
Vector3 ParticleSize = new Vector3(0.5f,0.5f,0.5f);
// No textures
Mesh PolyParticleMesh = new Mesh(6,0,-1,3,PolyParticleEx.PolyParticleVertices);
// Create Material for this object
Material Material2 = new Material();
Material2.SetSpecular(0, 0, 0);
//Create Cube Shader
Shader Shader2 = new Shader(iContext, R.raw.vsonelightnotexture, R.raw.fsonelightnotexture);
// ok
SphericalPolygonExplosion explosion = new SphericalPolygonExplosion(NumberParticle
s, Color, ParticleLifeSpan, RandomColors, ColorAnimation, FadeDelta, ParticleSize, m_Context,
PolyParticleMesh, null, null, Material2, Shader2 );
m_Pyramid.AddExplosion(explosion);
}
Finally, in the onSurfaceCreated() function, the CreatePyramid() function was added and called to
actually create the pyramid when the GL surface is created.
CreatePyramid(m_Context);
 
Search WWH ::




Custom Search