• 🏆 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!

First Person Camera

Status
Not open for further replies.
Level 10
Joined
Nov 28, 2008
Messages
655
I am stupid?

I cannot figure out how to get a camera to follow my unit...

>_<

I am sure it is one simple function, but I can't figure it out...


I want it to be right in front of his face, not above it.

Code:
O       = unit
*       = camera
<>^v = direction looking
Code:
>       O*


v       O
         *


<     *O


^      *
        O
You get the point, hopefully.

I can't get the camera to follow the unit in that way, can someone give some advice? I will post the map in a few mins if I still can't get it.
 
Level 7
Joined
Nov 13, 2006
Messages
243
  • Camera Initialization
    • Events
    • Local Variables
    • Conditions
    • Actions
      • ------- Attach Regions
      • Region - Attach a_Player 1 View Region to PlayerUnit[0] with offset (Point(0.0, 0.0))
      • ------- Apply Cameras
      • Camera - Apply Player 1 Camera for player 1 over 0.0 seconds with Existing Velocity% initial velocity, 10% deceleration, and Include Target
      • ------- Camera Mouse Rotation
      • Camera - Turn Camera Mouse Rotation On/Off(1, On)
      • ------- Mouse Relative Mode
      • Camera - Lock Camera Mouse Relative Mode On/Off(1, On)
      • ------- Camera Bounds
      • Camera - Set the camera bounds for (Player group(1)) to a_Player 1 View Region (Do Not adjust the minimap)
  • Camera Follow
    • Camera - Follow for player 1 (Unit group(PlayerUnit[0])) with the camera and Clear Current Target
Player unit array variable is from my map so replace that with your unit and a_Player View Region is from my map too so replace that too. (make the region of size 0.25).

  • Camera Update
    • Events
      • Timer - Every 0.015 seconds of Game Time
    • Local Variables
      • CameraBounds = ((Position of PlayerUnit[0]) offset by -0.3 towards ((Camera Yaw of Player(1)) + 90.0) degrees) <Point>
    • Conditions
    • Actions
      • ------- Camera Bounds
      • Camera - Set the camera bounds for (Player group(1)) to (Region((X of CameraBounds), (Y of CameraBounds), ((X of CameraBounds) + 0.01), ((Y of CameraBounds) + 0.01))) (Do Not adjust the minimap)
      • ------- Camera Height Smoothing
      • Camera - Turn camera height smoothing Off for player 1
      • ------- Camera Height Displacement
      • Camera - Turn camera height displacement On for player 1
  • Unit Update
    • Events
      • Timer - Every 0.0001 seconds of Game Time
    • Local Variables
    • Conditions
    • Actions
      • Unit - Make PlayerUnit[0] face (Camera Yaw of Player(1)) over 0.0 seconds

Hope this gives you an idea.
 
Level 10
Joined
Nov 28, 2008
Messages
655
  • action -
    • Camera - Set the camera bounds for (Player group(1)) to (Region((X of CameraBounds), (Y of CameraBounds), ((X of CameraBounds) + 0.01), ((Y of CameraBounds) + 0.01))) (Do Not adjust the minimap)
can u explain that one better?

I can't seem to mimic that.
 
Level 1
Joined
Feb 24, 2010
Messages
62
Should be like this:

1. Select 'Set Camera Bounds'.

2. Select Player Group and set it to:
- 'Convert Player to Player Group'.

3. Select 'Playable Map Area':
- Select 'Convert Rectangle to Region';
* Select the first '0.0', and set it to 'X of Point' (down the list), and set point to your point variable (in your case: CameraBounds).
- * Select the second '0.0', and set it to 'Y of Point', and set the point again to your variable.
* Select the first '1.0', and set it to 'Arithmetic (Real)';
= Set 'Value' to 'X of Point', and the point to CameraBounds.
= Set '1.0' to '0.01'.
* Select the second '1.0', and set it to 'Arithmetic (Real)';
= Set 'Value' to 'Y of Point', and the point to CameraBounds.
= Set '1.0 to '0.01'.

4. Set 'Do' to 'Do not'. (D'oh!)

Hope it helps.
 
Status
Not open for further replies.
Top