Camera Rotation

Juliano

New Member
Reaction score
8
In my rpg there will be a camera that locks to your character and has different angle and etc, ok I know how to do that...

But I dont know how to do like if a player presses the left arrow key, the camera rotates left 20º, if he/she presses the right arrow key, the camera rotates 20º to the right, problem is, how to do it without unlocking the camera?
I want to know this because pressing the Delete, Page Down,Page Up,Insert buttons and etc dont locks the camera, it goes to the direction, but you need to hold pressing it, and I want when u press left arrow or right arrow key the camera rotates 20º permanently, so if you pressed right arrow, you can easily re-locate your camera by pressing left.
Undestand?Help please!!Thanks, and sorry bad english I'm from Brazil...
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Code:
Every 0.01 seconds of game

Apply camera object <Camera you cant>
Set Real_CameraRotation to Facing of <Unit001> + Real_WantedAngleDifference[X]
Set Rotation for player X of Current Camera to Real_CameraRotation
Lock camera to <Unit001>

Will set the camera behind the unit constantly, unless Real_WantedAngleDifference[X] is increased or lowered, in which case it will constantly change the camera to the angle you want, re-locking it to the unit (so PgDn, Del, etc. don't mess up your camera)


Code:
Player X releases Left Arrow
if Real_WantedAngleDifference[X] Less Than 340
  Then: set Real_WantedAngleDifference[X] = Real_WantedAngleDifference[X] + 20.00
  Else: set Real_WantedAngleDifference[X] = Real_WantedAngleDifference[X] - 340.00

Code:
Player X releases Right Arrow
if Real_WantedAngleDifference[X] More Than 20
  Then: set Real_WantedAngleDifference[X] = Real_WantedAngleDifference[X] - 20.00
  Else: set Real_WantedAngleDifference[X] = Real_WantedAngleDifference[X] + 340.00

With these 2, the wanted angle always stays between 0 and 360
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top