Hello, I was working on something today, and started brainstorming and got my idea down. I am working on custom bows in modpe, and this proves to be very difficult. I was using a transparent layput over the screen, to get when the player pressed it, and with a basic onTouch listener it worked good, but only one issue, I cant move my FOV when it is up, actually I cant access any mcpe ui through it. So I made it take up the right half of the screen, the it worked fine, except I could move aroud while holding it down. Now I dont really need the dpad at this stage, where the player draws the bow back and is about to fire, but I do need to aim, which obviously I cant.
So I had another Idea, track motionEvent's x and y and set the players rotation according to that. but It seems that I suck at math. No no, not simple algebra and geometry, its the hard algorithms. anyways here is what I have, But it crashes everytime android.view.MotionEvent.ACTION_MOVE is triggered.
Hello, I was working on something today, and started brainstorming and got my idea down. I am working on custom bows in modpe, and this proves to be very difficult. I was using a transparent layput over the screen, to get when the player pressed it, and with a basic onTouch listener it worked good, but only one issue, I cant move my FOV when it is up, actually I cant access any mcpe ui through it. So I made it take up the right half of the screen, the it worked fine, except I could move aroud while holding it down. Now I dont really need the dpad at this stage, where the player draws the bow back and is about to fire, but I do need to aim, which obviously I cant.
So I had another Idea, track motionEvent's x and y and set the players rotation according to that. but It seems that I suck at math. No no, not simple algebra and geometry, its the hard algorithms. anyways here is what I have, But it crashes everytime android.view.MotionEvent.ACTION_MOVE is triggered.
layout.setOnTouchListener(new android.view.View.OnTouchListener(){onTouch: function(v,motionEvent){if(action==android.view.MotionEvent.ACTION_DOWN){if(action==android.view.MotionEvent.ACTION_CANCEL || action==android.view.MotionEvent.ACTION_UP){if(action==android.view.MotionEvent.ACTION_MOVE){Want Custom ModPE functions? Look here -> WolfyPE ModPE functions