[Feature request] Read player camera properties in manialinks

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
Posts: 1897
Joined: 25 Aug 2011, 21:45
Location: Poland

[Feature request] Read player camera properties in manialinks

Post by Dommy » 14 Oct 2019, 21:36

I've already suggested that, but providing better examples it might catch the attention:
Dommy wrote:
12 Jun 2019, 15:15
Read camera properties in UI layer scripts

Code: Select all

CMlScriptIngame {
    const Vec3 PlayerCameraPosition;
    const Vec3 PlayerCameraDirection;
    const Real PlayerCameraYaw;
    const Real PlayerCameraPitch;
    const Real PlayerCameraRoll;
    const Real PlayerCameraFov;
These properties available within ingame manialink scripts could be then used for example by the minimap, where the map would no longer rotate with the car, but the player camera.
Scenario: the player does a 360 in mid-air. While the camera barely even rotates, minimap follows the car 1:1, doing a full round as well.
Basically, right now the minimap can be confusing in several situations, like here:


The camera is sprung about 45 degrees off the car's direction vector. Minimap reads the AimYaw property of the player, so the car will always point upwards on the map. Because of that, the minimap can confuse the player by showing the positions of other people at an "incorrect" angle.

Even better example while driving reverse:


Player sees what's behind their car up the front of their view. Minimap however still is aligned straight with the car, instead of being rotated 180 degrees (I just had to write a workaround for this!). Players normally expect to see the danger at the bottom half of their radar, which should always be "behind their view".

You can also see the compass at the bottom of the screen, which points in the direction of our target player to capture. Unfortunately, when reversing, the direction doesn't reflect the true position of the target, instead, it shows the angle as if viewed on the minimap (take a look at the arrows).

Trivia: this compass code has been carried over from your official Chase mode, meaning that Chase has exactly the same problem as Hunters.

Lastly, when showing custom player names, I calculate the distance between the player and opponent, allowing me to make the nameplate smaller as the opponent is further away. I, however, had to make a special check for the camera free (cam 4/7), as the name scales would remain unchanged when the camera is moved, causing confusing disproportions. For example, the name would grow/shrink as the player drives around, without any camera movement.
Dommy wrote:
12 Jun 2019, 15:15
Another use is custom marker frame scale/opacity changing according to the distance to the camera itself, rather than the car.
Scenario: I'm showing a custom marker to my player. This marker will fade away if the player is too far from this location. The marker should disappear if the camera is too far away, but instead, it stays on the screen while the player is close. Same in the opposite situation, the marker won't show up when the camera is close unless we drive here first.
What would happen if this suggestion got implemented?

Players would see a less confusing minimap and a compass, which properly points towards their target, regardless if they're driving forwards or backward.

(This image is just a simulation, no workaround is possible, except flipping the map, seen below.)


This is the workaround I just wrote, which rotates the map by 180 degrees when the player speed is below 0 (driving backward).

Ryzen 7 2700X, GTX 1070 Ti, 16 GB RAM, Windows 10 Insider Build


Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest