• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Dynamic Camera System

Status
Not open for further replies.
Level 30
Joined
Jan 31, 2010
Messages
3,551
Hello :)

I'm busting my ass on this little system I'm working on, but I can't get it right any way I try.

Basically, there's one area of the map, where there should be a dynamical camera system, disorientating and confusing players. The area looks like this:
attachment.php
And here's the full, entire overview of that area:
attachment.php


Now, what I need of this system is to follow the character in a fashion that the camera will always face the way the hero's trajectory related to the terrain is. Since it's hard to explain with just words, here are the examples with images:
attachment.php


In this case, the Hero walks straight in a line, having regular, normal camera. When she has got the the rectangle, which represents a region, the camera should slowly turn and look like this, following the character. The camera will stay this way even when the mouse wheel is rolled, so it's locked from zooming in or out (due to terraining work with infinite cliff levels, the camera must be fixed at a certain distance or it will be pretty much right on the top of the wooden flooring). If the character goes back to the starting position, the camera wouldn't return to original position, but it would rather turn around to follow her back, so it would be inverse of starting position. The camera isn't fixed on the hero, you can explore around, but entering the region would turn around the camera angle.



attachment.php


In this case, the Hero has walked to the second region, thus triggering the camera again to turn around and face the Hero's direction of walking.



attachment.php


The final case shows that the Hero has walked backwards for a little, and when entering the region, the camera triggered to turn by 180 degrees, which is default camera view. Note that until the region was hit, the camera was locked on the previous angle of view.


The map is called Moonchant, by the way. It's a roguelike map in development.
The one who'd want to do this system for me would, of course, get the map to work directly on it, but for the sake of not showing spoilers anywhere, I will not post it here. If you want to work on it, say and it's yours :)
Of course, reputation and full credits will be given, as well as a special contribution in the team award in either form: an item, achievement, hero, or a unit.

Problems I've encountered while trying to make this are these:
- Couldn't find a way to lock the mouse-wheel so that the distance will always be at a fixed value; otherwise, the standard camera would go through the terrain.
- Couldn't detect from which direction the unit was coming from, thus making my cameras often turn around and not follow the path where the hero is going.
- Using panned camera over 2.5 seconds has also locked the entire screen for it's duration of turning, making it unavailable to look around by moving the mouse to the edge of the screen.
- Clicking left click on nothing (terrain) stopped the camera movement.

Hope there's someone to help me with this system. Cheers!
 

Attachments

  • Preview.JPG
    Preview.JPG
    57.6 KB · Views: 183
  • Overview.JPG
    Overview.JPG
    61.3 KB · Views: 199
  • CameraFirst.JPG
    CameraFirst.JPG
    46 KB · Views: 148
  • CameraSecond.JPG
    CameraSecond.JPG
    57.3 KB · Views: 163
  • CameraThird.JPG
    CameraThird.JPG
    59.6 KB · Views: 152
Level 4
Joined
Nov 25, 2014
Messages
88
Nice, very helpful system and am looking forward to it.


For the direction problem you are having trouble with. Try using the and' condition since your using regions.

Unit leaves region'
And
Enters region'

face camera'blablabla


idk if u tried that already :p gl on your project :)
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Here we go.

My strategy was this:
- Define the area using vertical regions and horizontal regions. These regions will overlap with each other.
- Every tick, count how many regions a hero is in.
- If a hero moves from a location with 2 regions overlapped (T-junction) to a location with only one region, a camera change is triggered.
- Direction is determined by comparing the hero's current x/y with the last x/y
- Apply the camera rotation every 0.03 seconds, making it smooth and difficult to cheat. Also apply default values for distance and angle of attack, which works to prevent mouse wheel scrolling.

It was fun to make, and thank you for describing what you wanted so well :)

Setup is a simple case of putting all the regions in a list.

Let me know if anything needs to be changed.
 

Attachments

  • DynamicCameraSystem.w3x
    20.1 KB · Views: 53
Status
Not open for further replies.
Top