SRL Archive - SRL Development and Help

[Suggestion/idea] Calculating camera pitch level


HT BaaFly

2014-12-16 02:57:44

I've been wondering about a function that returns your camera angle (not compass) for a while. Has something like this ever been implemented in SRL before, using color only? I read somewhere that Brandon's GL include has a function that returns pitch level but I am looking for a color only solution. If there is anyone who has tried to tackle this problem before, please share your idea and/or progress.

Thank you and have a good day :)

Frement

2014-12-16 03:43:07

I guess a good start would be to try use the player model as a basis for the calculations. Most likely the only way to calculate it at least with some accuracy. For example get the height from lowest and highest angle with the position on main screen, then any values between those could simply be calculated.

HT BaaFly

2014-12-16 03:53:43

True, I've thought of that, but the problem with this idea is that if there is an obstacle infront of your character - tree or a wall and you can't see your player - this would not work as well. But then again, you could have it rotate the camera if a certain point on the player was not detected, such as top of head or feet or something and then proceed to calculate the height. :P

Frement

2014-12-16 03:58:14

If there would be an obstacle in front of my character, I would most likely move my camera to make way for my character :) So rotating camera in such situations would be completely reasonable in my opinion. And to verify any test values you can use the console when developing this.

Flight

2014-12-16 06:07:22

I have a pretty accurate way of determining the pitch on OSRS, but I'm guessing this question refers to RS3?

Frement

2014-12-16 06:30:19

From: Flight
I have a pretty accurate way of determining the pitch on OSRS, but I'm guessing this question refers to RS3?


OpenGL was mentioned in the original post, so I would assume it's RS3 :)

HT BaaFly

2014-12-16 06:44:39

@Flight Yes, this discussion was meant for RS3 but I don't see a reason to not include OS as well, as long as it involves color :)

@Frement How would you go about setting a default point for the script to check hieght. What I mean is, different accounts always have different gear on so I don't see how to calculate a universal point for all. Pardon me, I'm new to this kind of development. Most of my scripts go like this: if health low then eat. Not much innovation as you can see :p

Frement

2014-12-16 06:47:47

From: HT BaaFly
@Frement How would you go about setting a default point for the script to check hieght. What I mean is, different accounts always have different gear on so I don't see how to calculate a universal point for all. Pardon me, I'm new to this kind of development. Most of my scripts go like this: if health low then eat. Not much innovation as you can see :p


Just throwing some ideas out there, but you could maybe get a big box around the playerPoint and calculate the most prominent color from outwards. Then use that color to mask out the ground and what not, and get the player model only by using edge detection or something else which you might come up with.

Brandon

2014-12-16 14:52:26

I'm not sure if this will work or not but the idea I had was to:

At the start of the script, grab a point on the player's head OR feet.

When the camera goes up or down the calculate the offset of the head or feet from that point?

HT BaaFly

2014-12-18 02:54:09

The two methods are similar to me, I think:confused::confused: but in any case I'll try my luck and post any progress here

The Mayor

2014-12-18 03:52:29

May I ask why you need a function like this? If you don't need to know current pitch, but need to make it a certain pitch, it will be easier to go MS_ANGLE_HIGH/LOW and then keyDown/up for a certain number of ms.

Frement

2014-12-18 03:53:41

From: The Mayor
May I ask why you need a function like this? If you don't need to know current pitch, but need to make it a certain pitch, it will be easier to go MS_ANGLE_HIGH/LOW and then keyDown/up for a certain number of ms.


I would assume this is for more human-like and accurate object clicking based on a minimap tile (for example a loot drop or NPC).

HT BaaFly

2014-12-18 06:15:56

@The Mayor If you have ever noticed while playing RS3, whenever you get disconnected from a server and automatically relog back in, your player's pitch level is set to the minimum. This can be troublesome if your script is not able to run properly at an angle other than the highest. For example, you can't see top part of the bank chest in CW if your pitch level is low. This leads me to think such function will be useful. As for your suggestion, it would seem very botlike to me if the player frequently tries to adjust his angle when it's already adjusted. So we need a function that returns an accurate pitch level. Hope I was clear :)

Frement has valid points as well, this could greatly benefit minimap to mainscreen coords conversion

The Mayor

2014-12-18 16:39:30

From: HT BaaFly
This can be troublesome if your script is not able to run properly at an angle other than the highest.


This is why I asked what you needed the function for. If that's the reason, then there are much easier ways to go about it. If not findObject then set angle high, for example.

HT BaaFly

2014-12-19 05:34:58

From: The Mayor
This is why I asked what you needed the function for. If that's the reason, then there are much easier ways to go about it. If not findObject then set angle high, for example.


There's a difference between the easy way and the right way. For example, let's say that you're in a different area than the one which has the object. If you do go and call findObject then you're most likely going into a loop. I can think of a few other examples but I think you got the point, I just don't get why you are so unenthusiastic about this :confused:

Frement

2014-12-19 05:55:14

From: HT BaaFly
There's a difference between the easy way and the right way. For example, let's say that you're in a different area than the one which has the object. If you do go and call findObject then you're most likely going into a loop. I can think of a few other examples but I think you got the point, I just don't get why you are so unenthusiastic about this :confused:


Because this is not something that can be achieved with the needed (in my opinion) accuracy that easily.

Zhendos

2014-12-23 07:30:21

Nice suggestion!
Support.