Quantcast
Channel: Latest Questions by Max 4
Browsing all 60 articles
Browse latest View live

Using the scrollwheel

I am using the scrollwheel to change weapons in my game, and was wondering if there was a way for it to recognize which way the scrollwheel is turning. Any help?

View Article



Limiting the time my gun can shoot

I am trying to limit the rate of fire for my gun. I use this script: function Update () { machineflash = GameObject.FindWithTag("machineflash"); // raycast settings var direction =...

View Article

Making a shotgun

I want to make a shotgun using raycasts. I have a script for a pistol and was wondering if I could edit it. function Update () { pistolflash = GameObject.FindWithTag("pistolflash"); // raycast settings...

View Article

Ammunition not working

So, here's my ammunition script: var damage : float = 5; var gunshot : AudioClip; var muzzleflash : GameObject; var aclip : int; var ammo : int; function Update () { pistolflash =...

View Article

Just a simple JavaScipt question

In JavaScipt, you can add a number to a variable that is an int by going variable ++; but is there a way to add larger numbers to this variable?

View Article


Making a sound play at a moving point

Hi. I'd like to make sounds that play at a moving point. Currently I use AudioSource.PlayClipAtPoint(sound,transform.position); What should I use?

View Article

Easy explosion script

Here's the script: var explosion : GameObject; function OnCollisionEnter (collision : Collision) { Instantiate (explosion, transform.position, transform.rotation); Destroy (gameObject); } But it says...

View Article

Invisible Audio Listener

So, in my scene I have a first person controller, a terrain, and directional light. When I try to run it, it goes to the default blue and says that there are 2 audio listeners. I have tried deleting...

View Article


Changing mouse sensitivity

What do I use to call mouse sensitivity in JavaScript?

View Article


Toggle camera sensitivity

So here's what I'm adding to a JavaScript version of MouseLook: if (Input.GetButton("Zoom")) { sensitivityX = 1; sensitivityY = 1; } How do I make this so that it toggles on and off?

View Article

Making an object move with the camera

For some reason, when I child an object to my FPS controller's camera it doesn't move up and down, only left and right. Has anybody else encountered this before?

View Article

Multiplayer tutorial help

I am using the muliplayer tutorial, and the first code is bringing up some odd errors. Assets/connectionGUI.js(17,41): BCW0012: WARNING: 'UnityEngine.Network.useNat' is obsolete. No longer needed. This...

View Article

Multiplayer spawning error

So here's what I'm using: var Player : Transform; function OnNetworkLoadedLevel () { // Instantiating Player when Network is loaded Network.Instantiate (Player, Vector3 (Random.Range (5, 95),...

View Article


Spawning above the terrain

For my multiplayer game, I want random spawning. This is what I'm using: Network.Instantiate (Player, Vector3 (Random.Range (5, 95), transform.position.y+4, Random.Range (5, 95)), transform.rotation);...

View Article

Player not deleting on server exit

So, here's a slightly altered code from the IOS multiplayer var Player : Transform; var camera1 : Camera; function OnNetworkLoadedLevel () { camera1.enabled = false; // Instantiating Player when...

View Article


Making a plain number range

I know about Random.Range, but I would like to say "x equals 1 to 10", and using just Range doesn't work. What do I do? [EDIT] Hmm, ok, maybe it would be better if I explained what I wanted to do. I...

View Article

Making a new function

I want to make a new function, but I want this function to act the same as OnCollisionEnter. How do I do this?

View Article


Colliding with a character controller

So, I have an object that I want to disappear when a FPS controller collides with it. My code doesn't work. function OnControllerColliderHit (hit : ControllerColliderHit) { Destroy (gameObject); } What...

View Article

Destroy on range command

Ok, so here is my code: function Update () { transform.Rotate (Vector3 (0, 2, 0)); target = GameObject.FindWithTag("Player"); range = Vector3.Distance(target.transform.position, transform.position); if...

View Article

Animating hinges

I have a cube, with cylinders that I want to make legs. I have given them both Hinge Joints at the point I want them to pivot around, but I don't understand what I do if I want to make an animation...

View Article
Browsing all 60 articles
Browse latest View live




Latest Images