Sniper's Paradise!


Sideview

This is fairly simple coding wise but a little more subtle than most things to understand, but once you do, it like opens up a whole new world of possbilities. Any viewing angle is possible, and all look incredible running in Unreal.

class SideView expands MaleTwo;
event PlayerCalcView( out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
{
   // Just need to set bBehindView to true, otherwise the 1st person
   // perspective model is used (i.e. just the gun, no player, not
   // something we want here :P). Also set ViewActor to yourself, cuz
   // that's what you're looking at.
   ViewActor = Self;
   bBehindView = true;
  
   // The Camera's location is a vector that is placed at the player
   // when this function is called. Because we want to implement a
   // side view camera, we will have to shift it to the right by a
   // certain amount. The Y component of a actor's location is its
   // side to side offset, while X is front to back and Z is up and
   // down. So lets move the Camera over to the side of the player
   // by a certain amount plus the size of the Player Model. I'll
   // choose 350 for this, but really you can mess around with it to
   // get the desired view.
   CameraLocation.Y += CollisionRadius + 350;
  
   // Great, so now we have our camera positioned to the side of the
   // player, but unfortunatly, up to this point, it will be facing
   // whichever direction the player is facing, or his ViewRotation.
   // To avoid this, we should set the camera's rotation to something
   // fixed, because we don't want the camera to tilt for this
   // tutorial, ofcourse this is totally arbitrary and you can modify
   // it however you want. Rotation consists of 3 quantities, Pitch,
   // Yaw, and Roll. Without going too much into it, Pitch is the
   // up-down tilting, yaw is the left-right tilting and Roll is
   // basically just that how much the thing is rolling. For our
   // purposes, we just want the camera to tilt to the side a bit
   // and look at our model from the side, so lets create a new
   // rotator that will not have any change in up/down tilting, or
   // roll, but will tilt/look to the side by -50 to essentially
   // look at the player.
   CameraRotation = rotator(vect(0,-50,0));
}

Now you have a great new camera view coded, but how do you go about seeing it in a level?? Well, there are two options, the easiest, for yourself anyways is to do it using Unreal.ini. Just open up the file, and at around the 25th line or so under the section [URL] will be a line called Class="blah" where "blah" is the name of your default player type, just change this to be Class = YourPackageName.YourClassName, and your all set. You can now use this perspective in any map you wish that does not change the default player value, which is most. The other alternative is to create your own gameinfo class that will have your player as a default. This is more beneficial if you want to create a new hud, or want to get rid of the CrossHair. Look at my Hud tutorial for info on creating a new gameinfo class.



Spam Killer

Back To Top
2005 Sniper's Paradise
All logos and trademarks are properties of their respective owners.
Unreal™ is a registered trademark of Epic Games Inc.
Privacy Policy
Website by Softly
Powered by RUSH