Well I have my (meshes) grappling gun made as well as the “Hook” projectile and attached to my Main Camera on my FPS charector controller. My problem I need more help with is i believe the firing (shoot) script I found on here subbed for my own reasons. Maybe it’s not a shoot script but from what i know about java so far I do believe it is a shooting script. Take a look at it ::
var projectile : Rigidbody;
var initialSpeed = 20.0;
var reloadTime = 0.5;
var ammoCount = 20;
private var lastShot = -10.0;
var sound : AudioSource;
var r : AudioClip;
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));
sound.PlayOneShot(r);
// Ignore collisions between the missile and the character controller
Physics.IgnoreCollision(instantiatedProjectile.collider, transform.root.collider);
lastShot = Time.time;
ammoCount--;
}
}
The error at the bottom left of the screen says – ArgumentException: You are not allowed to call Internal_CloneSingle when declaring a variable.
Move it to the line after without a variable declaration.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.Object.Instantiate (UnityEngine.Object original) (at C:/BuildAgent/work/6bc5f79e0a4296d6/Runtime/ExportGenerated/Editor/BaseClass.cs:65)
NewBehaviourScript…ctor () (at Assets/NewBehaviourScript.js:1)
Don’t know what it means obviously cause I didn’t make the script but I still think it should work. Any thoughts or corrections I can fill in it that you all can help me with. It would be much appreciated
-johnny