Jump to content

How to move the camera in search of an object?


trainux

Recommended Posts

I am in an area cutting trees, but in a moment the camera is left in a direction where there are no trees, then it remains without doing anything.

The tree I have declared it in the following way:

final RS2Object tree = objects.closest ("Tree");

And to move the camera try the following:

Camera camera = new Camera ();
camera.toEntity (tree);

 

Link to comment
Share on other sites

Few things.

1. If you plan on using .interact, such as tree.interact("Chop"), do NOT use camera.toEntity. InteractionEvent in OSBot will handle this for you, and theres a few additional checks it will perform.

2. You're setting the tree to final and getting the closest tree. What happens when that tree is cut down and a new tree appears? This is no longer the same tree than what we started with.

Edit: Moved to Scripting Help. This was under Unofficial Scripts & Applications which this is not.

  • Like 1
Link to comment
Share on other sites

33 minutes ago, Alek said:

Few things.

1. If you plan on using .interact, such as tree.interact("Chop"), do NOT use camera.toEntity. InteractionEvent in OSBot will handle this for you, and theres a few additional checks it will perform.

2. You're setting the tree to final and getting the closest tree. What happens when that tree is cut down and a new tree appears? This is no longer the same tree than what we started with.

Edit: Moved to Scripting Help. This was under Unofficial Scripts & Applications which this is not.

Thanks, solved.

  • Like 1
Link to comment
Share on other sites

  • Alek locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...