Friday, 15 July 2011

java - RayCast algorithm in Bukkit -



java - RayCast algorithm in Bukkit -

i've been wondering if possible in bukkit plugin create raycast scheme utilize to, off vector, create ray could, instance, summon particles every many blocks along it. don't have much experience math; in 8th grade geometry , haven't gotten trig yet. didn't want utilize player.gettargetblock() , player.getlineofsight() because deprecated , getlineofsight() gives me list of blocks, , looking list of locations or , able alter distance interval between each location in list.

thanks. hope can solution this. know people have done before, when search raycast algorithms, gives me ways write doom-like game engine.

looks have found solution, here if want know it. test plugin, so, testing, added /vec command check vector , /shoot command shoots particle. args /shoot [length of ray] [space between particles in blocks]. length cannot decimal (it code changes) space between particles can. stop particle @ solid block, break loop when lastparticle.getblock().gettype().issolid() false.

http://pastebin.com/cve5vg8u

p.s. used darkbladee12's particleeffect library this, utilize effect class, has couple of effects.

java algorithm bukkit raycasting

No comments:

Post a Comment