PDA

View Full Version : Best way to make camera see object



Unfold
06-28-2014, 06:23 PM
Hey, i'm using reflection to click on an object. However, it is clicking on an object even when it can't see the object (i don't want to get banned).

What's the best way to move the camera but in a way so it sees the object. Objects are show at any angle :/

cosmasjdz
06-29-2014, 01:12 PM
If its only 1 object you can try orient camera according to dot in minimap. But if its for example much more red dots then goodfight, this method doesnt work. (Or actually do, you just need to sort tpa from minimap middle maybe). You can try roughly divine minimap angles every 60 degrees or so and then rotate it accordingly. Have tried it somewhere in my first scrips. but tpas and walking worked for me better, probably deleted, cant find the example.

Patriq
06-29-2014, 06:20 PM
This method is from powerbot, it gets the angle that the camera should have given the object tile/location



public int mobileAngle(final Locatable mobile) {
final Tile t = mobile.tile();
final Tile me = ctx.players.local().tile();
int angle = ((int) Math.toDegrees(Math.atan2(t.y() - me.y(), t.x() - me.x()))) - 90;
if (angle < 0) {
angle = 360 + angle;
}
return angle % 360;
}


Try to convert it to simba, Im sure that its not impossible, you just need to have the tile of the object using reflection.

Krazy_Meerkat
06-30-2014, 02:23 AM
If you're using reflection, you can get the compass angle with R_GetMinimapAngleDeg, if you want to move the compass to a certain angle you can use R_MakeCompass.
Edit: I just converted that function to work in simba with reflection. We now have a new function: R_RotateCameraToTile(Tile: Tpoint);
Thanks for the paste, Patriq.

Flight
06-30-2014, 06:12 AM
Oh yeah, I did this a while back, I used it for my fisher. You can check out the thread here:
https://villavu.com/forum/showthread.php?t=87714

Patriq
06-30-2014, 06:46 AM
By the way can we use reflection with the Runescape 3 client?
I tried it, and I got some values but they never changed ;(
Are there multipliers for runescape 3?

Krazy_Meerkat
07-01-2014, 08:05 AM
By the way can we use reflection with the Runescape 3 client?
I tried it, and I got some values but they never changed ;(
Are there multipliers for runescape 3?

I'm not quite sure how much you're asking here.. The old school reflection include won't work with rs3. Here's the rs3 logs http://javahacking.org/forum/index.php?/topic/731-811/ if you want to try some stuff on your own.. I didn't see any multipliers, but sometimes people just don't like to share.

Patriq
07-01-2014, 11:28 AM
Yes I went to ask about them, and they say I have to finde them myself :P
Ohh well its ok, I wish I could do some reflection support for runescape 3 :3

MysteryMuffin
07-05-2014, 03:08 PM
When I was dabbling in reflection and using it to click on an object, I always used color to backup the reflection to get the best of both.

To do this, first you use R_TileToMS to get the point in the center of the tile you're looking for, which I'm guessing you're already doing.

Then I turned that point into a box and drew it in Smart by using something like this:


BoxTopLeft := IntToPoint((ReflectionTileCenterPoint.x - 14), (ReflectionTileCenterPointCenterPoint.y - 14));//Takes that center point and goes up and to the left 14px and makes a point there.
BoxBottomRight := IntToPoint((ReflectionTileCenterPoint.x + 22), (ReflectionTileCenterPoint.y + 22));//takes the center point and goes down and to the right 22px and makes a point there.

Box := PointToBox(BoxTopLeft, BoxBottomRight);//takes those 2 points you just created and turns them into a box
SMART_DrawBox(Box);


You'll need to play with those values a little bit to ensure that the object you're looking for is completely within that box at just about every angle.

Then it's just a matter of looking in that box for the colors you need.

This will in ensure that no matter what, you're only clicking on objects you can actually see.

Then you can work out how to move the camera angle until said colors are found within "box" by using repeat until to repeat camera angle movements until you find the colors you're looking for in the box you just made using FindColorsTolerance.

Frement
07-05-2014, 03:37 PM
When I was dabbling in reflection and using it to click on an object, I always used color to backup the reflection to get the best of both.

To do this, first you use R_TileToMS to get the point in the center of the tile you're looking for, which I'm guessing you're already doing.

Then I turned that point into a box and drew it in Smart by using something like this:


BoxTopLeft := IntToPoint((ReflectionTileCenterPoint.x - 14), (ReflectionTileCenterPointCenterPoint.y - 14));//Takes that center point and goes up and to the left 14px and makes a point there.
BoxBottomRight := IntToPoint((ReflectionTileCenterPoint.x + 22), (ReflectionTileCenterPoint.y + 22));//takes the center point and goes down and to the right 22px and makes a point there.

Box := PointToBox(BoxTopLeft, BoxBottomRight);//takes those 2 points you just created and turns them into a box
SMART_DrawBox(Box);


You'll need to play with those values a little bit to ensure that the object you're looking for is completely within that box at just about every angle.

Then it's just a matter of looking in that box for the colors you need.

This will in ensure that no matter what, you're only clicking on objects you can actually see.

Then you can work out how to move the camera angle until said colors are found within "box" by using repeat until to repeat camera angle movements until you find the colors you're looking for in the box you just made using FindColorsTolerance.

You can do -64, -64 to the tile you are looking at to get the top-left corner when turning into screen coordinates (R_TileOffsetToMS I think).