Graphics Reference
In-Depth Information
theProjectile.LookAt( theProjectile.position +
fireDirection );
// add some force to move our projectile
theProjectile.rigidbody.velocity= fireDirection *
projectileSpeed;
}
public virtual Transform MakeProjectile( int ownerID )
{
// create a projectile
theProjectile= SpawnController.Instance.Spawn( projectileGO,
myTransform.position+spawnPosOffset + ( myTransform.forward
* forwardOffset ), myTransform.rotation );
theProjectileGO= theProjectile.gameObject;
theProjectileGO.layer= myLayer;
// grab a ref to the projectile's controller so we can pass
// on some information about it
theProjectileController= theProjectileGO.GetComponent<Projec
tileController>();
// set owner ID so we know who sent it
theProjectileController.SetOwnerType(ownerID);
Physics.IgnoreLayerCollision( myTransform.gameObject.layer,
myLayer );
// NOTE: Make sure that the parentCollider is a collision
// mesh which represents the firing object
// or a collision mesh likely to be hit by a projectile as
// it is being fired from the vehicle.
// One limitation with this system is that it only reliably
// supports a single collision mesh
if( parentCollider!=null )
{
// disable collision between 'us' and our projectile
// so as not to hit ourselves with it!
Physics.IgnoreCollision( theProjectile.collider,
parentCollider );
}
// return this projectile in case we want to do something
// else to it
return theProjectile;
}
}
Search WWH ::




Custom Search