Search Unity

Ship / Camera behavior from Halo Reach's space combat

Discussion in 'Scripting' started by AlwaysSunny, Aug 28, 2012.

  1. AlwaysSunny

    AlwaysSunny

    Joined:
    Sep 15, 2011
    Posts:
    260
    For those who wouldn't know, or to refresh your memory: http://www.youtube.com/watch?v=pPmkxo-cc4I

    I've been doodling around prototyping for a little arcade shooter, ideally marrying the flight controls of freelancer (screen-space mouse-based steering) with a camera system similar to what's observed in this video. Rather than explaining my lackluster attempts, I'd love a few words from any readers about how you'd approach modeling this system. Not asking for a ton of detail, but I could use some fresh ideas, particularly regarding emulating that slick camera action. (Keeping the ship out of the center of the screen ~90% of the time while allowing turns to displace its relative on-screen position)

    Would sure appreciate some guidance! :)
     
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Unity provide a smoothfollow script.

    I would start there and tweak as needed.
     
  3. AlwaysSunny

    AlwaysSunny

    Joined:
    Sep 15, 2011
    Posts:
    260
    Hey, I appreciate the response. I'm already doing much more robust camera work than what's present in smoothfollow. Perhaps I'm over-complicating, but smoothfollow's methodology does not yield results of the desired complexity. Looking for alternative ways of thinking about managing the system, as the ship control and camera system must work together quite closely to achieve the behavior observed in Reach's combat. Looking for general strategies that may not be obvious to a third-person-cam-controller newbie.
     
  4. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    I admit I didnt like unity's camera scripts and wrote my own, but sometimes simpler is better
     
  5. imjacobf

    imjacobf

    Joined:
    Aug 3, 2012
    Posts:
    39
    Something you could try (and I'm not sure if my explanation is going to make any sense) is using an empty GameObject to hold the position in space that you want to get to. Then you will have a different script on the camera vs the ship that will follow that point. This point will update every frame and always be a certain distance ahead of either the camera or the ship (so that they do not catch up to it). You can do a Raycast to get the screen position of the mouse and use that to set the object's position.

    Again, probably a terrible explanation but you can easily get something like Halo: Reach has going using this solution :p
     
  6. AlwaysSunny

    AlwaysSunny

    Joined:
    Sep 15, 2011
    Posts:
    260
    imjacobf, that's sounds kinda similar to what I'm doing presently. :) The issue with this method is that it doesn't satisfy the "keep the ship outta the middle of the screen" requirement very well. Currently experimenting with determining my camera 'height' offset based on the direction / magnitude of the turning force, which might work out eventually. Still, I get the feeling I'm going about this all wrong..

    Thanks for the response! :)
     
  7. imjacobf

    imjacobf

    Joined:
    Aug 3, 2012
    Posts:
    39
    Haha, if you figure out a better way, let me know! I don't always take the most optimal routes in my plans :)
     
  8. unitrade

    unitrade

    Joined:
    Aug 27, 2012
    Posts:
    20
    ya same here. just beginning to use it. if anyone knows a way. just post more information here.
     
  9. AlwaysSunny

    AlwaysSunny

    Joined:
    Sep 15, 2011
    Posts:
    260
    The most success I've had so far has been achieved by using the basic principles of unity's smoothfollow script, but instead of looking-at and following fixed points, adjusting these points based on situational criteria such as speed / turn rate. It still seems pretty heavy-handed to me, and doesn't reproduce the behavior I want very well, but it does look pretty slick in its own right, and may have to do.

    More ideas would be welcome, thanks!