Camera, Update, and etc

Hy people, again,

Well, that’s it, i’m really lost, and i can’t find an exit. Sure the problem it’s mine, and not with unity.

So, i decide to restart everything… and i’m implore your help friends…

  • The “coder”
    Well…i’m not coder… i’m a little bit skilled in programing in flash, and well with the dot sintax, flash objects and stuff.

  • The Project
    Here we’re doing an architectural visualization, and we had some sucess with the prefab FPS, a little modificated. This part of the job is working.
    Now, we need to do some “hot points” on the build. We’ll create one interface, so you can click, ando go to the point listed.

Based on my poor knowledge in unity, i’ve plan to modified the “smooth follow” script (that one from tutorial), to work with this ideia. So i’ve create one empty object with the modified script, and trigger this with a MouseDown from a GUI Texture.

The idea was to on each click, we “send” to the function on the empty a variable name, then, we start the script to force the camera to navigate to that point, and as son it’s stop, the user can move across the build again.

Ok, but some things aren’t working
The GUI Texture onMouseDown only works one time.
I can force the FPS script to stop (enable = false), but i cant make it come back to life… (tried _camera.GetComponent(“FPS Meu”).enabled = true; _camera.GetComponent(“FPS Meu”).Update()).
The FPS just jump to the point… it don’t navigate across the build until that.

Obviously some problems are about understand unity, and how it work, and is because this i’m here asking you to help me to find a way to make this thing working. It’s this way the best way to do that? I can do some of those things i think i can ?

Thanks for all of you for patience and support… really.

Again, if i’m talking like the caveman’s, please forgive my english…

Thanks a lot

Is there a way to instantiate a game object with a waypoint on mouse click, and have the fps prefab head straight for it? Cant help codewise sorry, but check out the fps tutorial to see the waypoints in action?

AC

You can use emty game objects with a debug gizmo (like an image, or a wireframe sphere) and place it where you want your camera to move to.

When you want to move there you find the blank game object in unity either by name or by tag (see the docs), then you get the transform.position of it to move towards it.

To actually move towards the target, there are a few ways (like steering behaviours).

The easiest way I can think of, but not the best, is to use transform.LookAt(myWaypointPosition) to rotate the camera towards the waypoint, then apply your motion how you want.

Unfortunately, that wont look very good and it can be tricky to get the motion correct. The only other way I can think of is steering behaviours which would allow smooth motion.

I unfortunately don’t have time to give you a code example tonight.

I hope that helps, and if I have time later on, I’ll try to get some code to you, but I’ll be off for a few days.

-Jeremy

I missed a bunch of stuff (serves me right for posting tired).

What you want to do is fire a raycast out from the camera. The point where that raycast hits becomes your seek-to target. Then you use what I said above to get there.

-Jeremy