Quantcast
Channel: Answers by "Peter G"
Browsing latest articles
Browse All 90 View Live

Answer by Peter G

You shouldn't need to do any uv work. Just some clever texturing. Make a gradient bar then have an alpha cutoff based on how loaded the scene is. See Eric's answer here for a good place to start....

View Article



Answer by Peter G

New folders should work fine

View Article

Answer by Peter G

I don't really use `boo`, but if it's much like C# or js, then you should be able to take out the cast and then it will probably be okay. class scriptEnemy(MonoBehaviour): public tr as Transform = null...

View Article

Answer by Peter G

Try this: var script : PlatformMovement; //This shouldn't be a static variable. function OnTriggerEnter(object : Collider) { if(object.CompareTag("Platform 2") { script =...

View Article

Answer by Peter G

The problem is with the implied delegate [ElapsedEventHandler][1]. Your function `_timer_Elapsed` doesn't fit the signature because it returns an IEnumerator. Now you have two choices how to fix it....

View Article


Answer by Peter G

My first guess is that you are overwriting it somewhere later down the function or something along those lines. I would see if the `playerState` becomes `"climbing"` during the frame its pressed. So...

View Article

Answer by Peter G

I haven't ever developed for the windows 8 touch screen so I don't know if it works with `Input.GetTouch()`, but if it does, then you should be able to do: var touch = Input.GetTouch(0); var deltaX =...

View Article

Answer by Peter G

Unity doesn't use the generic web JavaScript. It's built on top of the Mono framework which is based on the .Net framework. You probably want use `String.IndexOf()` as documented [here][1] var data =...

View Article


Answer by Peter G

Can you just reassign it to the camera?

View Article


Answer by Peter G

Your problem is that you are trying to index wrong. You use square brackets to index, not ()'s. Hence this: Legs.animation("WalkForward").speed = _LeftJoy.position.y; should be this:...

View Article

Answer by Peter G

I'm a little curious why you are pushing this operation to another thread? But for starters, the delayed execution functionality of `yield` that Unity only works if you call it from `StartCoroutine()`....

View Article

Answer by Peter G

Unity does not include any built-in functionality to implement forcefields, but it provides plenty of tools to set it up. I would set up a system something like this: - Each field source has a function...

View Article

Answer by Peter G

It usually means that you have a mesh collider (with attached rigidbody) that isn't totally enclosed or is non-manifold.

View Article


Answer by Peter G

That's probably the easiest way to do it. Yes. The only thing I would worry about is overdraw. Putting a plane over the whole screen essentially means you have to draw every pixel at least twice. So...

View Article

Answer by Peter G

It's because whoever wrote the code is writing it into a Vector3. The `?:` (It's called the conditional/ternary operator) is setting the x value of the Vector3. Then the y component is 0, and the z is...

View Article


Answer by Peter G

The general equation for linear interpolation is your second one. Output = (1 - t) * Input1 + t * Input2 It can nicely be expanded to higher degrees (see Bezier curves) and vectorized. Just treat the...

View Article

Answer by Peter G

From my experience, you actually have to get the particles before you can set them. Not every frame, but at least once you need to get some existing particles before you change them and reassign them....

View Article


Answer by Peter G

You really shouldn't compare floats this way, but the comparison operator is two equal signs: if (StackNum == 1) { }

View Article

Answer by Peter G

You should just be able to add the initial value to the result of `Mathf.Repeat()` var answer = 50f + Mathf.Repeat( Time.time * TimeMultiplier , 50);

View Article

Answer by Peter G

I see what you're trying to do, and it could work. It just seems like a rather circuitous way of doing it. I might try something like this. Vector3 offset = target.position - transform.position;...

View Article

Answer by Peter G

Moving a character to a point is the same process as moving value to a destination. You find the direction then move in that direction until the offset is less than a specified precision. void Update...

View Article


Answer by Peter G

I would do something like this: var scoreMultiplier = 5; function Start () { InvokeRepeating( "DecreaseMultiplier", 30 , 30); //You could easily set this up as a coroutine if you wanted variable times....

View Article


Answer by Peter G

You have 2 errors. It looks like you are trying to call the constructor to create a new Vector3. The issues is that there are no constructors that take a Vector3 as an argument (you can copy it, but...

View Article

Answer by Peter G

I'm not totally sure that the design of your program makes sense. Your card class is currently working as both the container class for a card, and the enumeration of all the cards in the player's hand....

View Article

Answer by Peter G

The problem is that a mutual conversion exists. To quote the [MSDN page][1] on your error.> In a conditional statement, you must be able to convert the types on either side of the : operator. Also,...

View Article


Answer by Peter G

There's two errors. One of which is causing the compiler, and the other of which is just causing broken behavior. You have to assign the output of `Mathf.Clamp()` to something. `inAirVelocity` is...

View Article

Answer by Peter G

A draw call is basically a batch of triangles sent to the GPU for drawing. In general every object with a different material creates another draw call (there are ways of combining draw calls, but...

View Article

Answer by Peter G

If I'm understanding your question correctly, you shouldn't need any other variables. Can you do something like this: int minimumWage; int poverty; function Update () { if(minimumWage

View Article

Answer by Peter G

If you're accessing `counter` from a member function in the same class that counter is declared in, then you can access it without a type identifier. Otherwise you need to put the class name before you...

View Article



Answer by Peter G

'RED' and 'BLUE' are [instance variables][1] (compare to [class/static variables][2]). You need to find the instance to access there values. The easiest way to do that is: var cube = FindObjectOfType(...

View Article
Browsing latest articles
Browse All 90 View Live




Latest Images