[HELP] How To Follow Player's Camera Screen?

Report any bugs here or ask questions here!

[HELP] How To Follow Player's Camera Screen?

Postby YensLe » 29 September 2020, 10:14

My problem here is that it doesn't look like there's a real way to make a region follow player's camera which has to include the cursor and the player coordinates and have them combine to rightfully fit into player's camera and moves along with it and if you attach a decor to it then it'll follow the player's camera making it look like it's stationary with where the camera of the player is regardless if it moves or not due to same speeds with the actual camera and also able to have things follow along with the player's camera screen making them look like they're part of the player's camera is also nice.

I find this feature very useful in terms of many things such as making enemies hunt player if player's camera had enemies on screen essentially or simply have a var counter that counts how many enemies there are on player's camera screen and tracks how many enemies are alive on player's screen for example.

I'm still trying to figure this one out.

I'm thinking a feature that allows us to attach things to characters in ALE like how backgrounds and other things have could have been easier and better come to think of it that allows us to attach things to the player itself or the cursor or simply the camera screen itself.

Plus having a new trigger action that allows us to control whether or not to show a specific character's health bar along with their nicknames as I think that'll be a nice addition too as I think so.

YensLe
Cyber Grub [25]
 
Posts: 32
Joined: 26 September 2020, 08:12

Re: [HELP] How To Follow Player's Camera Screen?

Postby Nyove » 29 September 2020, 14:08

Hey YensLe,

I understand your point of an object following player's camera.
The closest thing you can have is by using a background with offset of 1,000,000.

This will result in a background that has a sky effect.
Ensure your background is larger than the player's camera, so it gives the illusion that the background is following the player's camera.

Limitations:
- Only works with background, not with any other objects.
- Background is rendered in PNG, not SVG, which means that the background will look different in different screen size.

Well, I really hoped that there's a proper trigger action to achieve this effect. But for now, we wait patiently for PB2.5 / new update.

Best regards,
Nyove
Proud to be part of something meaningful.
Need any assistance? Join the PB2 discord server at https://discord.com/invite/Bhe9rNz or raise a support ticket at https://www.plazmaburst2.com/support

Contact me on discord for quickest reply possible.

User avatar
Nyove
Moderator
 
Posts: 255
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: [HELP] How To Follow Player's Camera Screen?

Postby jeje52 » 29 September 2020, 16:07

You can get the coordinates of the camera center by calculating the midpoint of the player and cursor coordinates. So get the coordinates, add together the player and cursor coordinates and divide the results by 2, which should give you the coordinates of the screen center.

screen x = (player.x + cursor.x) / 2
screen y = (player.y + cursor.y) / 2

This way it won't always be exactly in the center, for example if you move the cursor too fast or have slow camera enabled it'll follow behind a bit, but it gives more freedom to do whatever you want to do.
User avatar
jeje52
Civil Security Lite [100]
 
Posts: 146
Joined: 13 April 2018, 19:52

Re: [HELP] How To Follow Player's Camera Screen?

Postby YensLe » 1 October 2020, 04:40

Jeje52, that's a parallax effect while I was looking for a way to have an object be attached to the player's camera which has to follow along with cursor and the player.

Nyove, I guess so as in the meantime until I finally find a way to make objects be attached to not just the cursor or the player but both which is the camera itself.

YensLe
Cyber Grub [25]
 
Posts: 32
Joined: 26 September 2020, 08:12

Re: [HELP] How To Follow Player's Camera Screen?

Postby nightmar » 1 October 2020, 09:26

I do not want to look stupid, but can't you make a region, give it the camer'as size and make it move to the player's cursor at all times?
How many bugs does this game have anyway? jeez
User avatar
nightmar
Usurpation Destroyer [350]
 
Posts: 393
Joined: 2 September 2017, 19:36
Location: Inside your closet or under your bed

Re: [HELP] How To Follow Player's Camera Screen?

Postby Nyove » 1 October 2020, 13:03

Hi nightmar,

Attempt to go to a match and try to pan your cursor to the extreme side. You will notice that the camera follows to the midpoint of the cursor and the player itself.
https://cdn.discordapp.com/attachments/ ... apture.PNG

By constantly moving the region to the cursor, the center of the region will be located at the center of the cursor, not the center of the camera. The center of the camera is mostly in the midpoint of the cursor as well as the player.

The problem with this is the keyword: mostly.
A lot of factors can ruined this experience, such as different camera settings and different FPS. This flaw alone really destroys the illusion of it being static and make the background look like it's following and moving the background toward's the camera's center.

Best regards,
Nyove
Proud to be part of something meaningful.
Need any assistance? Join the PB2 discord server at https://discord.com/invite/Bhe9rNz or raise a support ticket at https://www.plazmaburst2.com/support

Contact me on discord for quickest reply possible.

User avatar
Nyove
Moderator
 
Posts: 255
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Re: [HELP] How To Follow Player's Camera Screen?

Postby jeje52 » 1 October 2020, 14:34

YensLe wrote:Jeje52, that's a parallax effect while I was looking for a way to have an object be attached to the player's camera which has to follow along with cursor and the player.

It's not parallax. I've used the exact same math to make hud elements before. A parallax effect has to have a fixed point and neither the player nor cursor is one.
User avatar
jeje52
Civil Security Lite [100]
 
Posts: 146
Joined: 13 April 2018, 19:52

Re: [HELP] How To Follow Player's Camera Screen?

Postby nightmar » 1 October 2020, 20:15

Nyove wrote:Hi nightmar,

Attempt to go to a match and try to pan your cursor to the extreme side. You will notice that the camera follows to the midpoint of the cursor and the player itself.
https://cdn.discordapp.com/attachments/ ... apture.PNG

By constantly moving the region to the cursor, the center of the region will be located at the center of the cursor, not the center of the camera. The center of the camera is mostly in the midpoint of the cursor as well as the player.

The problem with this is the keyword: mostly.
A lot of factors can ruined this experience, such as different camera settings and different FPS. This flaw alone really destroys the illusion of it being static and make the background look like it's following and moving the background toward's the camera's center.

Best regards,
Nyove



Ooh I see now why it is so complicated, thanks for the enlightment
How many bugs does this game have anyway? jeez
User avatar
nightmar
Usurpation Destroyer [350]
 
Posts: 393
Joined: 2 September 2017, 19:36
Location: Inside your closet or under your bed

Re: [HELP] How To Follow Player's Camera Screen?

Postby YensLe » 3 October 2020, 08:42

jeje52 wrote:
YensLe wrote:Jeje52, that's a parallax effect while I was looking for a way to have an object be attached to the player's camera which has to follow along with cursor and the player.

It's not parallax. I've used the exact same math to make hud elements before. A parallax effect has to have a fixed point and neither the player nor cursor is one.


Okay then I guess I did something wrong then.

Will try that again but experiment with it more then, thanks.

YensLe
Cyber Grub [25]
 
Posts: 32
Joined: 26 September 2020, 08:12

Re: [HELP] How To Follow Player's Camera Screen?

Postby Yex » 16 October 2020, 01:51

I experiemented with something like this in a slender singleplayer map as well as AI tests with SCP 137 which uses a similar camera effect but the only problem is that the region is it only follows the cursor not along with the player which causes weird bugs such as when player looks at the object it deal damage and when the player looks away from the object it either deals damage or none at all and when player looks at the object again at a different angle it no longer deals damage.

I suggest a way to have this trigger action move region 'A' to player's 'B' camera.

Yes, once again replying to myself.
Now I really want to die. Just to get out of this embarrassment.
Don't talk to me.
User avatar
Yex
Civil Security Lite [100]
 
Posts: 103
Joined: 13 May 2020, 22:07
Location: Hell


Return to Bug Reporting, Help & Support

Who is online

Users browsing this forum: No registered users