Closed thejaustin closed 8 years ago
It's not a good post from me without emojis! Hahaha
Haha, labeling me.
Your a tagger :P
I think (in split touch or controller mode at least) this might be doable just from the player's pitch and yaw and raycasting to find the block - and then the sub-block - that is hit (In https://github.com/zhuowei/ModPEScripts/blob/master/500ise_paintbrush.js I used http://gamedev.stackexchange.com/questions/47362/cast-ray-to-select-block-in-voxel-game, https://raw.github.com/Overv/MineAssemble/master/reference/src/mineassemble.c to do that - I don't quite understand how it works though) but that wouldn't be practical and would break in regular touch mode, which doesn't have a crosshair
For regular touch, Minecraft PE does know where its own ray cast lands, so you can use that to find out which small block it intersects - I'll expose that and see if that helps
I added Player.getPointedVecX(), Player.getPointedVecY() , Player.getPointedVecZ()
, which allows ModPE scripts to access MCPE's "where on the block is the player touching" info - give that a try. it's in (x, y, z) in world coordinates. I'm not sure whether that's enough for this to work though.
(ps: for lols I used this to make a cow hover over the block my cursor's on:
Entity.setPosition(cowfly, Player.getPointedVecX(), Player.getPointedVecY() + 2, Player.getPointedVecZ());
Entity.setVelX(cowfly, 0);
Entity.setVelY(cowfly, 0);
Entity.setVelZ(cowfly, 0);
So even if this isn't enough for your use case, the floating cow certainly made me laugh)
Okay, so bringing up split touch...I forgot to mention that. Split touch needs to be enabled to do this efficiently. I will have it auto-enable split touch when you're holding a mini block. However, I've mentioned before that there's no ModPE code that lets you turn on crosshairs. If you could go ahead and add that it would help me alot. Thanks. :)
Hahaha
(stupid comment: why do you need split touch? just, like, zoom the FOV way in and both regular and split touch should be able to edit the blocks...)
Yes, but it would help players out a lot. I can promise you people will yell at me saying 'I can't place it directly on the corner of this block' IDK. Thanks for the help though. :)
ok, well, grab the latest beta (http://tinyw.in/bl) and see if that helps you. I'll look into split touch later, I guess.
Thanks man. :) Currently playing with code at 2 AM. DOES THIS MAKE ME A REAL PROGRAMMER? Hahaha
Honestly yes it does, survive 2 more hours then your a pro
Haha, I've done so until 4 AM before, but I need some sleep now. Hopefully I can figure this out tomorrow. :) Thanks to Zhuowei I'll be working my butt off on mini blocks!
I've done an all nighter once, only to find out I didn't have to spend all that time :/
@zhuowei maybe add a method that can change the options of minecraft pe, that will help a lot.
gfx_gamma:1
its value to 400 that way you can use Night Vision :)@KairusDarkSeeker or just apply the night vision potion effect to the player ;)
So I guess this is resolved - closing issue.
I don't know if you'll respond @zhuowei, but I'm still trying to figure out how to use this feature to find the pixels of a block to place a mini block there... 😟
I need a way to find the pixels of a block when I tap it. Top left, bottom left, etc. I have no idea how you would do this though. Maybe you could use the way that stairs find out where you've tapped on a block when being placed? If you would like to know why, this is for my Mini Blocks Mod. Thanks for ALL your help! :smiley:
Oh, and sorry for the run-on sentence :stuck_out_tongue_closed_eyes: