x


On Collision enter the next level? Help please?

Right, when my 1st person character has defeated all of the aliens, <-- done fine its task is to get to a box, which then should then teleport it to the next level! <--- i need help with the collision!

Here is what ive got so far:

  function OnControllerColliderHit (hit : ControllerColliderHit)

{

if(hit.gameObject == "crate3lvl") {

Application.loadlevel("Level 2.unity")

}

SO i kind of need some help! Please!

more ▼

asked Feb 20 '11 at 06:00 PM

JJAPrograms gravatar image

JJAPrograms
69 7 8 16

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first
function OnControllerColliderHit (hit : ControllerColliderHit)
{
  if(hit.gameObject.name == "crate3lvl")
    Application.loadlevel(1); // or "Level2" if you name it that way, use 1 if it's the second on the list.
}

Don't forget that you must add your level though to the list of levels

more ▼

answered Feb 20 '11 at 06:49 PM

codesennin gravatar image

codesennin
61 4

Thanks! Very Helpfull! I figured out that you need to change the 'if' statment to: if(hit.gameObject.tag == "crate3lvl"), but thanks for your version! My if statment is a bit glitchy so im using yours! Thanks Again! #

Feb 21 '11 at 02:32 PM JJAPrograms

Quick Question, Do you put this script inside the First Person Controller or inside the crate3lvl?

Feb 21 '11 at 02:33 PM JJAPrograms

ive found out that you need to give the crate a Rigidbody (kinematic ticked) and a amesh collider. :D

Feb 21 '11 at 03:30 PM JJAPrograms
(comments are locked)
10|3000 characters needed characters left

the crate doesnt need a rigidbody and a mesh collider for this particular bit of code. You need a box collider (because its a crate why use a mesh collider which takes more processing power) with "is trigger" checked.

please please PLEASE complete some basic tutorials and learn from them, also keep http://unity3d.com/support/documentation/Manual/index.html the unity manual handy so that you can find out simple things about the unity engine instead of asking stupid questions (I'm sure they are not stupid to you but seen as though you can find the answer with a bit of searching, yes they are a stupid) also when your having coding problems http://unity3d.com/support/documentation/ScriptReference/index.html keep the script reference around, it has every syntax and and how to use them.

also your "game" is spelt wrong, "private front tire" would be a good name for some form of driving army game but as a MASSIVE rip off of the official Unity FPS tutorial. And asking people to pay to download your (shockingly appauling) game is an insult, anyone who pays to download it is dumber than you are and all your doing is taking advantage of idiots. You know nothing about creating a game, I understand that everyone has to start somewhere, but you need to start from the begininng instead of sticking some crap on the internet and asking people to pay for it.

Also your website is horrible to navigate, http://www.webpagesthatsuck.com/ maybe you can see why after some RESEARCH. It's fools like you reproducing and producing kids that are fools like you, that's the reason why the human race is in decline. I appreciate you are making an effort to do something you have interest in and please I am not trying to deter you from being creative but you need to learn to create these things properly especially if you plan to ask money for it. Right now it looks like everything you have done is a joke, not a funny one either. I'm sure you can do better but you need to do three things

1) LEARN

2) RESEARCH

3) IMPROVE

never give up on your dreams but dont pretend that your puddle of hogwash deserves to be credited. Especially since you want people to pay you for it!

more ▼

answered Mar 10 '11 at 09:54 PM

AngryOldMan gravatar image

AngryOldMan
2.5k 12 21 47

Yet another question asked by my apprentice.

Mar 11 '11 at 04:27 PM JJAPrograms

Anyway, as you can see, there is no point in answering this question, it has already been answered, if you can't read.

Mar 11 '11 at 04:30 PM JJAPrograms
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2485
x322
x72
x58
x11

asked: Feb 20 '11 at 06:00 PM

Seen: 1846 times

Last Updated: Feb 20 '11 at 06:00 PM