Blockland Forums > Modification Help

Spawning an Item in Front of the Player

Pages: (1/1)

Plexious:

I currently have a /drop command but I'm not sure about how to do the above. I can spawn it above the player and push it in the right direction but I want to create an object in front of the player, where they are looking. Any ideas?

Treynolds416:

Do you need the position or something?

--- Code: ---function getPosInFrontOfPlayer(%player,%dist)
{
    return vectorAdd(%player.getEyePoint(),vectorScale(%player.getEyeVector(),%dist))
}

--- End code ---


Plexious:


--- Quote from: Treynolds416 on June 16, 2012, 02:56:40 PM ---Do you need the position or something?

--- Code: ---function getPosInFrontOfPlayer(%player,%dist)
{
    return vectorAdd(%player.getEyePoint(),vectorScale(%player.getEyeVector(),%dist))
}

--- End code ---

--- End quote ---
That should work. I'm not good with this sort of stuff.

Pages: (1/1)

Go to full version