playMaker

Author Topic: User Driven Camera Controls  (Read 419 times)

davebr

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
User Driven Camera Controls
« on: March 15, 2020, 09:27:57 AM »
Hello,
I am a total newbie to Unity and Playmaker. I am putting together an architectural walkthrough application that will have a line of buttons at the top that when each button is clicked, it moves the camera to that particular room in the building. I have been at this for weeks. I've been on the forums and gone through so many tutorials and nothing is working. The closest I can get is two buttons that will switch back and forth between camera positions but as soon as I try to add a third or more buttons it breaks.

So far the best tutorial that has gotten me the farthest has been Hutong Games tutorial User Driven Camera Controls . This one got me to the point where I have all the buttons visible on the screen and can switch back and forth between two but that's as far as I can get.

Like I said, I am a totally newbie and I don't know code so a lot of the forum responses are way over my head. I have come to learn quite a bit about Playmaker over the last month, which is good, but I'm still just not able to figure this out.

I have been messing with this for so long that I am now with my back against the wall with a deadline looming large and my frustration level is through the roof. Any help would be so greatly appreciated.

Thank you!

Thore

  • Sr. Member
  • ****
  • Posts: 480
    • View Profile
Re: User Driven Camera Controls
« Reply #1 on: March 15, 2020, 10:22:00 AM »
Hi,

The tutorial is practically ancient and probably not the best way to go at this.

There are great many unknowns in there.

A) how many rooms will there be? More rooms, more possible paths. A few paths could be animated, but if you have lots, it gets clunky quickly.

B) is the camera interactive (free looking around while it moves) or is it like a movie camera with predetermined angles? If the camera allows free looking around, then you need to look at a typical 1st person setup (as in shooters), but when it is on rails, you need to look into timeline and animation.

A few pointers:

1) cinemachine is a unity package with powerful camera tools. I recommend you look first into what it can do for you. And then look into specific tutorials or examples.

2) When testing things, break it down to elements and get them to work. In this case, forget about the buttons on screen and first simply trigger this through key presses, e.g. each room/button is mapped to a number key. To do this, just make a state with a “get key down” action. When pressed, go to the state where it moves the camera...

3) put the camera as child into a camera holder. Animate the holder from point A to point B. Name the animation clip along the lines of “from A to B”. Next, install Playmaker’s ecosystem. Then get
Animator Cross Fade, which allows you to directly play a certain animation clip (see discussion here). So, after pressing key 1, play animation clip “from a to b”.

4) This is just one way. Another way is use pathfinding. It’s pretty simple to use in your case, called NavMesh. The gist of this goes like this: each target location is a waypoint, e.g. a simple game object that is invisible. On pressing the key, move the holder to that waypoint, using pathfinding.


Hope this gives a few directions. good luck 😉

« Last Edit: March 15, 2020, 10:25:46 AM by Thore »

davebr

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: User Driven Camera Controls
« Reply #2 on: March 16, 2020, 12:44:39 PM »
Thanks Thore! I have 10 camera positions so 10 different buttons. The cameras do not need to have an interactive component, just set angles for the cameras.

Your pointers are a great start for me. I'll work through those and let you know if I run into problems.

Thanks for the help!