• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Detect Player "Camera" position

Status
Not open for further replies.

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
GetCameraTargetPositionX()
No, you don't need to. The function itself returns asynchronous value, depending on who's machine it's called.
For example, player 1 is currently looking at the exact center of the map. So the function will return "0" for player 1.
At the very same moment, player 2 is looking at different location, so it will return different value for player 2 (not "0").
I hope you get what I mean.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
So here's the pseudo code:
Code:
    if IsPlayerInForce(GetLocalPlayer(), ThePlayerGroup) and GetCameraPositionX() > RectMinX and GetCameraPositionX() < RectMaxX and GetCameraPositionY() > RectMinY and GetCameraPositionY() < RectMaxY then
        Do whatever here. But do note that everything's done here will be asynchronous. If you are not careful of what you're doing then it will lead you to desync problem.
    endif
 
Status
Not open for further replies.
Top