Quantcast
Channel: Latest Questions on Unity Answers
Browsing all 171066 articles
Browse latest View live
↧

Camera Follow Code Causes Jerky Movements

I need a script that will act like the included SmoothFollow.js but will also rotate on the X and Z axes. I messed around with it and came up with this: var target : Transform; var distance = 5.0;...

View Article


How to make an Instantiated prefab a Child of a gameobject that already...

Hi I have a script which will Instantiate prefabs which works fine but I wanted them to be added to a gameobject that already exists and make the instantiated prefab a child of the already existing...

View Article


Mouse wheel zoom

how can i change a variable smoothly with the mouse wheel (maybe using mathf.Lerp or some kind of interpolation) I need to change the distance var. Code: var target : Transform; var distance = 10.0;...

View Article

Metaball wiki script help

HI, I was playing around with metaballs and I tried the script on the wiki, but I ran into an issue. As the metaballs got further away from the game object they began to clip. Almost like there was a...

View Article

2d Variable Types Not Highlighted

Very new to Unity here, so maybe this issue is on my end, but it's something I've noticed. When I type in variable types in Monodevelop like "Rigidbody" or "Collision" they are highlighted in green...

View Article


Player Looking in Opposite Direction

Basically, if I move my reticle to the top of the screen, the player looks down and vice versa. This also applies horizontally. I am making a top down shooter. Take a look at what I mean: ![alt...

View Article

How to make plane rotate towards player and keep upright?

Hi, I'm trying to make my 2d plane rotate towards the player GameObject, but stay at 90 degrees on the x axis... Any idea on how to do this? I've tried a few things, but can't seem to freeze the x...

View Article

First person mobile controls easy.

Okay i made a game and i want to put it on iphone. I have everything done i just need to have first person controls on the iphone. I want the like two joysticks and i know there is this thing in mobile...

View Article


How to access custom components from a script?

I'm trying to write a script that will allow a component to be attached to the script from the Unity editor, such as an audio clip or an animation clip. Any ideas?

View Article


Object facing camera always in 2D game?

I'm working on 2D game and I'm trying to use the third person controller for my character but I need my character to always face the camera so he can be seen. Perhaps a modified version of the script...

View Article

This is my code and now how do i make the bullet shoot and how do i make it...

using UnityEngine; using System.Collections; public class NewBehaviourScript2 : MonoBehaviour { GameObject GrenadePrefab; void Update () { if(Input.GetButtonDown("Fire1")) { GameObject Grenade =...

View Article

Changing the coordinate system

So i've started exploring a space simulation game, and I created a ship w/ a movement script, I started moving around and went out fairly far from the origin. I discovered that due to the point float...

View Article

Math question, center of triangle that is part of a square

basically if i want to have a square whose bottom left point is 0,0 and top right is 1,1 the center of that square is .5,.5 but what if i want to have a triangle which is half that square exactly. so...

View Article


GameObject list not refreshing in Update()?

Hello. So I've got a landscape made of blocks (sort of like Minecraft) and am trying to create a behavior where any block that isn't visible isn't rendered. To do this, I've started by getting every...

View Article

Strange shifting when reseting player position to origin

I've been working on a script that will reset the position of the player back to the origin(0,0,0), when a certain object is touched. The object resets it's position fine at first, but then drifts...

View Article


How to select objects sharing the same material

So in all major 3d packages and game engines, there is a way to select all objects that share the same materials. I can't seem to find anything in Unity that would allow me to do this on a default...

View Article

Declaring a new Object (JS)

the following code does not work var myobj =new Object(); myobj.strength = 15; i get a long error, starting with "MissingFieldException: System.Object.strength". I am fairly proficient in my javascript...

View Article


Odd parenthesis expectation

So I have a script #pragma strict function Update(){ var enemyStats : Stats = gameObject.GetComponent(Stats); if(Input.GetKey("space")){ function OnGUI();{ GUI.Box();{Rect(0,0,10,10); "Your mom,...

View Article

Change connectedBody in script to Instantiate prefab

Hello. Sorry for my poor English. I have a problem that can not be solved, I hope for your help. I change **connectedBody** in SpringJoint to **null**, and it works. But when I **Instantiate** prefab...

View Article

Deffered Shading and MSAA

Okay, maybe this is a dumb question, but here it goes. Why is it impossible incorporate MSAA into a deferred pipeline? Personally, I could think of one or two ways that this could actually be achieved,...

View Article
Browsing all 171066 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>