hi i am new to unity and i am making a fps middel age game
since i am a realy bad scripter (i have no idea of it at all)
i am using pre made maps for unity tutorials to make my game
now here is my problem
the unity tutorial only has a science fiction fps
where it uses a machine gun or a rocket launcher
since i am making a bow i used the rocket launcher script
and i added the rocket script to the arrow
but the problem is the arrow does not do any damage
i just want the arrow to hit the robot and make sure the robot just dies
i don’t want a explosion and all these things
i just want to make the arrow so when ever it hits the robot robot dies
does some 1 know howe to do this?
i also have an other problem with maya
i can’t load any files from maya in to unity (see support topic)
thnx forreading and i hope some one knows howe to do it
this the the arrow script:
// The reference to the explosion prefab
var explosion : GameObject;
var timeOut = 3.0;
// Kill the rocket after a while automatically
function Start () {
Invoke(“Kill”, timeOut);
}
function OnCollisionEnter (collision : Collision) {
// Instantiate explosion at the impact point and rotate the explosion
// so that the y-axis faces along the surface normal
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal);
Instantiate (explosion, contact.point, rotation);
// And kill our selves
Kill ();
}
function Kill () {
// Stop emitting particles in any children
var emitter : ParticleEmitter= GetComponentInChildren(ParticleEmitter);
if (emitter)
emitter.emit = false;
// Detach children - We do this to detach the trail rendererer which should be set up to auto destruct
transform.DetachChildren();
// Destroy the projectile
Destroy(gameObject);
}
@script RequireComponent (Rigidbody)
and this is the bow script
var projectile : Rigidbody;
var initialSpeed = 20.0;
var reloadTime = 0.1;
var ammoCount = 20;
private var lastShot = -10.0;
function Fire () {
// Did the time exceed the reload time?
if (Time.time > reloadTime + lastShot ammoCount > 0) {
// create a new projectile, use the same position and rotation as the Launcher.
var instantiatedProjectile : Rigidbody = Instantiate (projectile, transform.position, transform.rotation);
// Give it an initial forward velocity. The direction is along the z-axis of the missile launcher’s transform.
instantiatedProjectile.velocity = transform.TransformDirection(Vector3 (0, 0, initialSpeed));
// Ignore collisions between the missile and the character controller
Physics.IgnoreCollision(instantiatedProjectile.collider, transform.root.collider);
lastShot = Time.time;
ammoCount–;
}
}
thnx for reading and i hope some 1 knows the answer