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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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