- Home /
how to change scene using rigidbody
hello well , i want to change scene using a rigidbody like , there is a dungeon and a rigidbody which is kinematic and meshrenderer is disabled when fps player touches it another scene ,ie, for xample 2 should be open , thnx for helping
Answer by FLASHDENMARK · Jan 16, 2011 at 09:07 AM
So you want the FPS to hit the invisible wall and then change scene? if so:
function OnCollisionEnter (hit : Collision)
{
if(hit.gameObject.tag == "Type the tag of your object that you are colliding with")
// You can change the tag in the inspecter.
{
Application.LoadLevel("Type the name of the level you want to load")
}
}
This should do the trick. When you collide with thw invisible wall then you change scene.
This should do the trick. :)
Answer by Justin Warner · Jan 16, 2011 at 06:09 AM
Use collision, if the player collides with the rigidbody, than it changes level.
LoadLevel: http://unity3d.com/support/documentation/ScriptReference/Application.LoadLevel.html
Should help a little bit...
Answer by Jicken · Aug 24, 2013 at 03:46 AM
This doesn't seem to work for me, as the level changed as soon as the collier object would collide with anything whatsoever except the player.