Switching scenes and object viewing

Hello everyone,

I’m very new to Unity3d. I’m coming from using Quest3d which I had to abandon due to lack of browser support and such.

I have limited knowledge of java/as3 coding so this will be a much harder transition for me. My projects are usually walking around an environment then clicking on an entrance sign to switch to a different scene or clicking on a board to launch a web browser. Will I need heavy scripting to achieve this or are there any premade assets I could use. I’d also like to understand the object viewing capabilities, I tried the mouseorbit but it orbits only with mouse movement without requiring holding down the mouse key, is there a way around this?

Sorry for being such a noob but after using the search a few times I started to realize most of postings were already a bit too advance for me. If anyone could point me in the right direction I’d appreciate your time and effort. Thanks and enjoy your weekend all.

Hey, welcome over to Unity!
I too came from Quest, due to ease of use with Unity, which I could not find with Quest.
I am not a scripter either, more the artist type.

For moving around your 3D environment, drag the First Person Controller from the PreFab Folder of the Standard Assets folder of your Unity project into the Hierarchy Panel. This will create (yep) a player to move around your scene.
To move between scenes (levels) create a scene and save it, open the Build Settings under File and click the Add Current button.
Create a new scene, save with your given name and add that to the build dialog.
Now you have both scenes referenced from both scenes.
In your first scene create an object and add the script (create a javascript file, click Create in the top of the Project Panel and choose JavaScript, paste the following text into the new js file):

function OnTriggerEnter(whatHitMe:Collider){ //detects it has been touched
Application.LoadLevel (“YOUR SCENE NAME”); // loads up the level
}


Select js Trigger in the object properties in the Inspector Panel under the collider section.
Now, when the player object collides with the object that has the js on it, if you have the other scene name between the quotes, it will put you in the other scene.
Just a note:
If you want to go back to the other scene, create a new js file, save it under another name, put the name of the first scene in the quotes, put it on an object in the second scene, select js Trigger and when you collide with the object you will be returned to the first scene.

This is very simple once you get used to it.
I got the script somewhere around here.

I am very dysfunctional with scripting but I can drag a script onto an object.

:slight_smile:

Have fun!
Don

PM me if you have any questions,
I’ll help as much as I can.

Haven’t done anything with the opening of a web browser, but I doubt it will be hard.

Hey Don,

Thanks for the quick response and help. I will give it a shot later tonight and keep you posted. How about the object viewer? I dropped the mouseorbit on the camera but it moves immediately with the mouse, is there a way to make it click and drag instead of moving solely on mouse movement?

Yeah, but I really don’t know how to do it…
:slight_smile:

I have some text that can be put into the MouseLook script to stop rotation of the view by right clicking and restarting rotation by right clicking again, but not really sure where to put it in the MouseOrbit script or if it is correct for that script.
I’m sure if someone stops by that knows what they are doing they can set it up for you.
The MouseLook script is what is used with the FPC (First Person Controller) camera.

I have got a way to do it

basically I add a switch that only turn on the camera orbit or look script when certain button is pressed down, in my case left mouse button, it works quite well for me

its very simple , if you guys still need it , I can post it here.

or is there better way to do it?

Sounds like what he is looking for (to me).
I’d like to have it myself…

:slight_smile:

Sounds like that’s exactly what I’m looking for.

so here we go

var mouseButton = 2;


function Update () {
    if (Input.GetMouseButton(mouseButton)) 
	{
        Debug.Log("mouse down!");
		
		GetComponent(MouseLook).enabled = true;
		
		Screen.showCursor = false;
		
    }
	else
	{
		Debug.Log("mouse up!");
	
	
		GetComponent(MouseLook).enabled = false;
		Screen.showCursor = true;
	
	}
}

you can easily make it work with MouseOrbit, just relace the componet name.

If you applying this to the FPS prefeb, remember to asign the script to both the parent controller and the camera inside, as they both have the mouselook attached.

Hope this works for you.

178264–6371–$key_to_enable_142.js (328 Bytes)

forgot to say, by default it’s set to the middle mouse button.

Thanks!

Thanks

Hey Don,

I got your code working in my scene, but this only works with walking into the object. Do you have anything for left clicking it?

Hey Box,

Do you have anything for zooming back and forth with the mouse wheel while orbiting?

No, I don’t have the code for it but it would be easy for anyone who knows how to code.

Don

Hey Don,

Got a friend at work to help me figure out the left click, it was OnMouseDown() replacing the trigger in your code. I still need a mouse wheel zoom going to run another search and see what I come up with.

Sounds like you are making some progress.
I have to reiterate, that isn’t my code, I found it somewhere, on the forums here, I think.

Yes I am making some progress, your help gave me a head start. Now I just need a mouse wheel zoom for my object inspector and I need something to turn a 3d models visibility On and Off.

It’s good to have clear goals…

:slight_smile:

Yea this coding is killing me though, lol.

Sure it will if it’s not your forte.
If you are not getting the input in the amount of time you wish, you could post a topic asking for help on a paid basis. If this is a possibility for you.