movement
Different approaches to moving around in Unity
Links
There are a bunch of links out there having to do with 'movement', but
most are imbedded in tutorials about other stuff. There are also a lot
of 'character controllers' that you can try, and many of these have
associated tutorials with them. The Standard Assets package itself
has some of these. We built our own, because we like building things.
Class Downloads
- movedemo.zip
-- the basic movement script ("observermove.cs" -- see below) we built
up. Also a 'stepped move' demo.
- teleportdemo.zip
-- three demo scenes showing a 'teleportation' move. One is triggered
by a space bar, the other by going through a GameObject set to 'isTrigger',
and the third with a space bar but with a nifty fadeout/fadein effect
on the flattened cube directly in front of the camera.
- tryraycast1.zip
-- very basic raycast usage: select objects with the mouse.
- raymovedemo.zip
-- use a raycast to select a plane and teleport to it.
- observermove.cs
-- use this file to add movement capabilities to your Unity scene.
Here's what you do:
1. Create a GameObject (it can be an EmptyGameObject, but doesn't
have to be). Maybe call it "observer" or something like that.
2. Make the Main Camera a child of that object. You might want to then
reset the Main Camera position tramsform to (0.0, 0.0, 0.0). That will
put it exactly where the GameObject ("observer") is.
3. Add the "observermove.cs" script as a component to the "observer"
GameObject.
Once you do that, you all set to move with the arrow keys, the w/a/s/d
keys, rotation with the SHIFT-arrow keys, etc.