Quantcast
Channel: Answers by "Matt-Downey"
Browsing latest articles
Browse All 90 View Live
↧

Answer by Matt-Downey

A good way to do this would be to collide if Vector3.Dot (or Vector2.Dot) of Player.velocity && rayInfo.normal (for a simple raycast) is less than 0. In order for this to work you need to go...

View Article


Answer by Matt-Downey

Almost positive I know your issue. I think you need to use cannon.transform.rotation (not local rotation) and cannon.InverseTransformDirection instead of Transform Direction for these two lines:...

View Article


Answer by Matt-Downey

I think the best thing for a 2D game would be to add a particle effect to simulate a glowing aura. http://unity3d.com/support/documentation/Manual/Particle%20Systems.html If you were to use 3D (doesn't...

View Article

Answer by Matt-Downey

This guy has made some epic code: http://forum.unity3d.com/threads/61133-Motion-blur-for-Unity-3 Here's his demo: http://vimeo.com/10287910

View Article

Answer by Matt-Downey

Check the y-coordinate of P1 and P2, if P1 is below P2 (lower altitude) Physics.CapsuleCast WILL work. If not, everything will go to hell....

View Article


Answer by Matt-Downey

Go to the tab "edit"-->"project settings"-->"physics" and look at the "min penetration for penalty" variable. If that variable is 0.05, then that is precisely the behavior the Unity3d dev team...

View Article

Answer by Matt-Downey

What you are looking for is the Dot product. You want to disable movement when the player is inside a wall, so if(Vector3.Dot(velocity,hit.normal) < -0.1) velocity = Vector3.zero; //when you get...

View Article

Answer by Matt-Downey

First something that might give you a little insight. Physics.SphereCast will return false if the imaginary sphere starts its "sweep" while already inside of an object. Basically, you can think of...

View Article


Answer by Matt-Downey

First off, that code is indeed in a script attached to the wall right? I would do it the other way around (attach the script to the cannon ball, which then finds a "wall" tag on collision), but it...

View Article


Answer by Matt-Downey

I'm always late in answering questions on Unityanswers, but... function Pace (normal : Vector3, vect : Vector3) { //By dot product/negative inverse, this is orthogonal to the normal var right : Vector3...

View Article

Answer by Matt-Downey

If it's first person, there should be a lot less worries than for a third person. Firstly, do you know about the camera trick where the player's gun and hand are placed in front of all other objects?...

View Article

Answer by Matt-Downey

My best guess would be to add a co-routine that is called every 1-5 seconds that sorts through the nearest objects and either enables or disables the collider based on whether or not they are within a...

View Article

Answer by Matt-Downey

I think you might be able to get this to work with fixed arrays. Usually with the javascript arrays you use float, int, string, etc (not GameObject from what I know). var arr : GameObject[]; //make a...

View Article


Answer by Matt-Downey

Assuming this is a 2.5D sidescroller, what you want to do is raycast downwards and find the normal. First I would add an empty gameObject to the scene gameObject-->create empty. Rotate this object...

View Article

Answer by Matt-Downey

that's probably because the model is rotated. In order to get this to work well, i would recommend: function Awake () //called when the arrow is instantiated, this is different than Start() {...

View Article


Answer by Matt-Downey

I think you can add the following to OnCollisionEnter: var temp0 : Vector3; var temp1 : Vector3; var temp2 : Vector3; temp0 = collision.transform.position; temp1 = transform.position; //Step1 temp2 =...

View Article

Answer by Matt-Downey

It shouldn't matter too much how many scripts you have. The thing that will kill your processor's speed is how many "Update" functions you have and the complexity of the code in those update functions....

View Article


Answer by Matt-Downey

The issue is that you are trying to redefine an already defined variable. Lets say unity has a variable transform.position, what you are essentially trying to say is private var transform.position =...

View Article

Answer by Matt-Downey

Ah, this seems to be the fault of not doing something like this instead: ball.timeToExplosion = length; Essentially, what you are doing is lacking the proper address to the variable you want to change....

View Article

Answer by Matt-Downey

Quaternions are not what you think they are. Quaternions are an odd 4D space that will never faulter when doing rotations, but as a result it has absolutely nothing to do with Eulers Angles (which you...

View Article

Answer by Matt-Downey

The problem is you are using "Left" and "Right" and a bunch of logical but nonetheless nonexistant buttons. Press Edit-->Project Settings --> Input and you can add "Left" and "Right" and so on if...

View Article


Answer by Matt-Downey

There is a function that I was referred to which is at least faster on the creator's machine: http://blog.alladvanced.net/2011/02/21/square-root-calculation-speed-in-flash-and-unity3d/ which I figured...

View Article


Answer by Matt-Downey

It's a very annoying fix, but I answered a question that should be able to fix the problem on only your pc (it has to be solved on a per-user basis):...

View Article

Answer by Matt-Downey

I'm almost positive transform.Translate is cheaper than rigidbody.MovePosition. If you use rigidbody.MovePosition, the object will sweep out the space afaik to make sure the object interacts with all...

View Article

Answer by Matt-Downey

I really dislike both of the methods because they get really whacky at larger angles, which prompted me to invent a new method a while back. Since then I've made two methods that should be better or...

View Article


Answer by Matt-Downey

Try this and attach it to the marble, so it wakes up the rigidbody: function FixedUpdate() { rigidbody.WakeUp(); } [Rigidbody.WakeUp][1]: There are settings in edit-->proj settings-->physics that...

View Article

Answer by Matt-Downey

I'm doing the exact same thing in my game. I've used a 3x3 grid and added darkness (fog) of war so the player cannot see copies of herself/himself. Here's the old [video][1]. I've since resolved a...

View Article

Answer by Matt-Downey

There are three methods for this (that I know), each of which will have similar results. The first two methods both use ***cookies*** for lights: ![picture][1]...

View Article

Answer by Matt-Downey

This is my solution. public abstract class CustomComponent : Component { public new CustomTransform transform; } public class CustomTransform { public Vector3 position { get { initialize_transform();...

View Article



Answer by Matt-Downey

In my opinion: Start() and Awake() are not equivalent to the constructor because ExecuteInEditMode + Serialization + closing/reopening Unity will result in calling Start/Awake 2+ times. I tried...

View Article
Browsing latest articles
Browse All 90 View Live


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