HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Overhead Camera  (Read 1272 times)

ShaolinNinja

  • General Accounts
  • *
  • Posts: 33
    • View Profile
Overhead Camera
« on: May 21, 13, 12:08:29 AM »

I apologize in advance, but I know next to nothing about scripting.

I am trying to make my own custom camera. It is an overhead top down style that uses the camera function lookatnext to target the current room. I can see 2 problems with my current script (though I am sure there more!)

LookAtNext needs to reference the current room. I don't know where to pull this value from or where to put it into my script (referenced below)

It seems like current room detection is based upon camera location, not character location. This would be a problem since the camera would lock onto the current room, but the room would never change when the character walks off the screen. What can I change so the active room is selected via character?

Code: [Select]
function PushAndActivateOH_CameraLayer()
  PushCmdLayer("OH_Camera")
  ActivateCmdLayer( "OH_Camera", true )
.
 
function DeactivateOH_CameraLayer()
  ActivateCmdLayer( "OH_Camera", false )
  ActivateCamera( "GAME" )
.
function SetupOH_Camera()
  camera as NodeRef = AddCamera("OH_Camera")
 
  LookAtNext("NAME", target, offset, 10.0, "SMOOTH")
  FreeLook( "OH_Camera", false )
  ActivateCamera( "OH_Camera")
.
function StartOH_Camera()
  PushAndActivateOH_CameraLayer()
  SetupOH_Camera()
.

The idea is that I want the camera to look at the current room and smoothly pan over to the next room as the active room changes. It should also pan back if the camera is in transition and the player goes back a room. Any help is appreciated.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Overhead Camera
« Reply #1 on: May 21, 13, 09:43:26 AM »

From my experience, you are correct in that the postion of the active camera is what determines which room is active.  So for your scenario, the movement of the character into the next room would be what would trigger the movement of the camera, and then as the camera moves from one room to the next that would trigger the activation of the rooms.

I would think you could set up a trigger volume between rooms to detect when the player moves room to room and move the camera based on that triggering, though that is just off the top of my head and there are doubtless other ways to do it.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

ShaolinNinja

  • General Accounts
  • *
  • Posts: 33
    • View Profile
Re: Overhead Camera
« Reply #2 on: May 21, 13, 11:45:58 AM »

Quote
So for your scenario, the movement of the character into the next room would be what would trigger the movement of the camera

With the current Hero Blade configuration, the character movement would never trigger the camera because the room would never change.

I need the character to activate the room, and then the camera will go to the new active room based on my camera script calling the active room.

I just don't how where to go to change the room activation from camera to character or if it is even possible based on Hero's room scripts.


Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Overhead Camera
« Reply #3 on: May 21, 13, 01:18:33 PM »

Quote
With the current Hero Blade configuration, the character movement would never trigger the camera because the room would never change.
I am a little confused by that statement.  It sounds like what you want to do is move the camera when room activation changes, is that it?
I don't believe it is possible to switch what controls room activation unless you purchase source code access.

Since the camera controls room activation, trying to move the camera when a room is activated is not possible, but it should not be necessary.

If the effect you are trying to achieve is that when the character walks into another room, the camera subsequently sweeps into that room, this should do that:

When a character walks into a trigger, based on which one it is you would know which room they were going to.  In the callback function of the trigger, pick a spot in that room and use the camera movement functions to move the camera to that spot, and then room activation will follow accordingly.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

ShaolinNinja

  • General Accounts
  • *
  • Posts: 33
    • View Profile
Re: Overhead Camera
« Reply #4 on: May 21, 13, 04:36:56 PM »

Quote
When a character walks into a trigger, based on which one it is you would know which room they were going to.  In the callback function of the trigger, pick a spot in that room and use the camera movement functions to move the camera to that spot, and then room activation will follow accordingly.

So how would I call that trigger in my camera script?
Logged

HE-Cooper

  • *****
  • Posts: 2221
    • View Profile
Re: Overhead Camera
« Reply #5 on: May 21, 13, 04:40:33 PM »

Just to clarify, as I"m not sure what you're trying to accomplish, a room is simply a box that determines visibility to other rooms and has an environment scheme associated with it. I suspect you might want to use a different entity, like a region, for whatever it is you are trying to do.
Logged

ShaolinNinja

  • General Accounts
  • *
  • Posts: 33
    • View Profile
Re: Overhead Camera
« Reply #6 on: May 21, 13, 07:51:37 PM »

Thank you for that suggestion. I guess what I really want is the center of the current heightmap. Is there a way reference the heightmap the character is on?
Logged