Jump to content

Position in front of player


todamach

Recommended Posts

Hey,

 

maybe someone has a method that returns position in front of a player?

 

Why would you need this? If you're trying to find out if you're interacting with an entity then it can be found in the API, let me know and i'll point you to it happy.png

 

Edit: Requested through pm- http://osbot.org/api/org/osbot/rs07/api/model/Character.html#getInteracting()

Link to comment
Share on other sites

Why would you need this? If you're trying to find out if you're interacting with an entity then it can be found in the API, let me know and i'll point you to it happy.png

 

Edit: Requested through pm- http://osbot.org/api/org/osbot/rs07/api/model/Character.html#getInteracting()

 

 

 

 

  • getInteractingpublic Character<?> getInteracting()
    Gets the character that this character is currently facing/interacting.
    Returns: The character.

 

I scrolled throught this sooooo many times. What is character exactly? Isn't it player or smth?

Link to comment
Share on other sites

thanks. Method, if someone might be interested:

	public Position positionInFront(){
		
		int dir = myPlayer().getRotation()/256;
		Position myPos = myPlayer().getPosition();
		Position pos = null;
		
		if(dir == 0){
			pos = new Position(myPos.getX(),myPos.getY()-1,myPos.getZ());
		}else if(dir==2){
			pos = new Position(myPos.getX()-1,myPos.getY(),myPos.getZ());
		}else if(dir == 4){
			pos = new Position(myPos.getX(),myPos.getY()+1,myPos.getZ());
		}else if (dir == 6){
			pos = new Position(myPos.getX()+1,myPos.getY(),myPos.getZ());
		}
		return pos;
	}
Link to comment
Share on other sites

 

thanks. Method, if someone might be interested:

	public Position positionInFront(){
		
		int dir = myPlayer().getRotation()/256;
		Position myPos = myPlayer().getPosition();
		Position pos = null;
		
		if(dir == 0){
			pos = new Position(myPos.getX(),myPos.getY()-1,myPos.getZ());
		}else if(dir==2){
			pos = new Position(myPos.getX()-1,myPos.getY(),myPos.getZ());
		}else if(dir == 4){
			pos = new Position(myPos.getX(),myPos.getY()+1,myPos.getZ());
		}else if (dir == 6){
			pos = new Position(myPos.getX()+1,myPos.getY(),myPos.getZ());
		}
		return pos;
	}

i dont need it but nice :D

Link to comment
Share on other sites

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

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