Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Raycasting hit

Comments in 'Plugin Development' started by WillotheBlessed, Sep 28, 2014.

  1. WillotheBlessed
    Offline

    WillotheBlessed Active Member

    Joined:
    Sep 17, 2014
    Posts:
    69
    Minecraft User:
    will
    Is there any plans to add raycasting to the current API? I see some 3D math utils, but nothing for raycasting. Preferably for hitting blocks or players or both, including Vector 3, Yaw and Pitch?

    Thanks in advance!
    Last edited: Sep 28, 2014
  2. Wantedkillerss
    Offline

    Wantedkillerss Active Member Plugin Developer

    Joined:
    May 9, 2014
    Posts:
    142
    Plugins:
    1
    Minecraft User:
    Wantedkillers
    why whould mojang use ray casting it has 3d . I remember that rycasting is an effect that old computers used to make the games appear like 3d
    but minecraft pe already has 3d so why do u ask?
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    He is talking about PocketMine math work -_-"
  4. WillotheBlessed
    Offline

    WillotheBlessed Active Member

    Joined:
    Sep 17, 2014
    Posts:
    69
    Minecraft User:
    will
    Yeah, in minecraft forge we c
    ould use some variant of this code to get what we're clicking or what a character is "look" at more importantly. I thought this would be nice for a few features I'm working on, but things are still in development, so I can't say what it will be yet. In any event, this type of calculation should be part of the api, right? (btw, raytrace and raycast seem to be interchangeable as far as definitions go, I'm not sure on the language because I don't really do this type of thing often.)

    Code:
    /**
         * Performs a ray trace for the distance specified and using the partial tick time. Args: distance, partialTickTime
         */
        public MovingObjectPosition rayTrace(double par1, float par3)
        {
            Vec3 var4 = this.getPosition(par3);
            Vec3 var5 = this.getLook(par3);
            Vec3 var6 = var4.addVector(var5.xCoord * par1, var5.yCoord * par1, var5.zCoord * par1);
            return this.worldObj.rayTraceBlocks(var4, var6);
        }
    
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,325
    Plugins:
    11
    Minecraft User:
    PEMapModder
    In fact, $entity->getDirectionVector() may be what you want. I forgot if it is the exact name; I need to sleep. But that may help.
    LDX likes this.

Share This Page

Advertisement