Random Chitchat 2012-2016
Same as in Lua.
Thanks given by:
with BlockTracer?
Thanks given by:
Do you want the direction or the block where the player is looking?
Thanks given by:
Player.LookVector
Thanks given by:
I want to get the rotation, and then aply it to the pig, so it moves were the player is looking.
Also, a MoveToPosition to the block the player is looking should work.

I've tried some codes and with this I change pig rotation, but it doesn't walk.
Code:
void cPig::Tick(float a_Dt, cChunk & a_Chunk)
{
    super::Tick(a_Dt, a_Chunk);

    if (m_bIsSaddled && m_Attachee != NULL)
    {
        if (m_Attachee->IsPlayer() && m_Attachee->GetEquippedWeapon().m_ItemType == E_ITEM_CARROT_ON_STICK)
        {
            MoveToPosition((m_Attachee->GetPosition()) + (m_Attachee->GetLookVector()));
        }
    }
}
Thanks given by:
m_Attachee->GetLookVector() returns a unit vector (vector of length 1), when you add that to the position, it will only very rarely point to any other block than the position itself. Try multiplying the look vector by, say, 10. And you should probably search down for the nearest ground from there, don't want to send the pig trying to fly Smile
Thanks given by: tonibm19
(06-20-2014, 05:45 PM)xoft Wrote: And you should probably search down for the nearest ground from there, don't want to send the pig trying to fly Smile
Shouldn't pathfinding do that?
Thanks given by:
It should indeed. And our debatable physics.
Thanks given by:
I'm not so sure - does our pathfinding work for flying mobs, too? If I send a ghast to XYZ, I don't want it to fly to the groundTongue
Thanks given by:
Ohloh reports we're finally getting the comment percentage up a bit:
https://www.ohloh.net/p/mc-server/analys...es_summary
Thanks given by:




Users browsing this thread: 6 Guest(s)