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

How to register a player's camera?

Status
Not open for further replies.
Level 10
Joined
Jan 28, 2009
Messages
442
I'm making a 3rd person p., keyboard controlled game, and I made it so that the character will always adjust his rotation to the player's camera, so your
move direction will always be relative to your current perspective when pressing any arrow key.

Only once I started the process of making the map playable in multiplayer, I realized that the function "Current Camera" is not attached to a player, but
just "Current Camera".
I can't seem to find any way in GUI to register the current camera view of the individiual player. And I wonder, if Current Camera cannot be set to any specific player, which camera view is it then?

Can anyone help with solving this problem?
 
Level 4
Joined
Mar 23, 2008
Messages
87
  • Camera
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Camera - Set (Owner of YourUnit)'s camera Rotation to (Facing of YourUnit) over 0.00 seconds
 
Level 10
Joined
Jan 28, 2009
Messages
442
So, are you trying to make the camera lock behind the character and follow it?

No.

I'm using a lazy camera in style of many video games. The camera doesn't completely follow the character. Instead it slightly adjusts to the character, while the character's movement direction (from button-push to game) is adjusted according to the camera.
Think of the smart camera in the Mario game series. It's a really nice and dynamic camera behaviour.

But the problem is that when you press any arrow key, the character must move in the direction of the camera +/- some degrees. And my question is; when I do this:

  • Set TempLoc = position of Character(1)
  • Set TempLoc2 = TempLoc offset by 128 towards Rotation of Current Camera + 90 degrees
What is current camera? I have four players. Whose view is "Current Camera"??
 
Level 4
Joined
Mar 23, 2008
Messages
87
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • Custom script: if (GetLocalPlayer() == Player(bj_forLoopAIndex-1)) then
      • Set TempLoc[Integer A] = position of Character(1)
      • Set TempLoc2[Integer A] = TempLoc[Integer A] offset by 128 towards Rotation of Current Camera + 90 degrees
      • Custom script: endif
 
Last edited:
Level 10
Joined
Jan 28, 2009
Messages
442
Um, yes Bomi. You finished my example, but you didn't find a sollution for the "Current Camera" problem. How does the trigger know what we mean by Current Camera? I wonder if this could be a GUI design "whoops!". The function should be player-attachable in some way, but that actually seems to be impossible in GUI...! *shock*

Well, I'll probably find another way around this problem. There's always a gap, and I think I might allready be on the track, so thanks for your good intends guys. I'll write again if I find myself totally lost.
 
Last edited:
Level 4
Joined
Mar 23, 2008
Messages
87
Only once I started the process of making the map playable in multiplayer, I realized that the function "Current Camera" is not attached to a player, but
just "Current Camera".
I can't seem to find any way in GUI to register the current camera view of the individiual player. And I wonder, if Current Camera cannot be set to any specific player, which camera view is it then?
I just gave you the individual player fix. I'm confused, what is it that you need?
In my example TempLoc2[1] is offset by 128 towards Rot of Player1's camera, TempLoc2[1] = player2's camera, and so forth
 
Level 10
Joined
Jan 28, 2009
Messages
442
Hey, sorry Bomi. It seems you solved my problem, but I didn't understand it until now *doh!*
I thought you didn't understand my question, but it was me who didn't understand the workings of your custom scripts. I'm not very good at JASS. Thanks! Now everything will be a lot easier, now that I finally get it, he he :)
 
Last edited:
Status
Not open for further replies.
Top