I actually got it to work by using this function

pPlayer->SetBaseVelocity( Vector(0, 0, 20) * 40 );

however, when I set the player's flag to FL_BASEVELOCITY it doesn't work 
anymore.

it works just how I want it to (except when you come down on the thing, you 
kind of....... break your legs).

and yes, you're right Garry. Inherently the player isn't a physics object 
till they reach the air (which I tested ;D), so in order to actually do 
anything with them you have to set the ground entity to null and then work 
with their physics object.

thanx for all the help guys.

--------------------------------------------------
From: "Garry Newman" <[EMAIL PROTECTED]>
Sent: Thursday, May 29, 2008 5:50 AM
To: "Discussion of Half-Life Programming" <[email protected]>
Subject: Re: [hlcoders] Changing the players Velocity?

> That refreshed my memory. If I remember right the player's physics
> object changes when they're not on the ground - that's why you do the
> SetGroundEntity( NULL ) thing.
>
> garry
>
> On Thu, May 29, 2008 at 1:28 PM, John <[EMAIL PROTECTED]> wrote:
>>  Try something like:
>>
>> #define JUMPPAD_V 1200
>>
>>  Vector    vForward, vRight, vUp;
>>    pPlayer->EyeVectors( &vForward, &vRight, &vUp );
>>
>>    Vector vecGo;
>>    pPlayer->GetVelocity( &vecGo, NULL );
>>
>>    vecGo += vUp * JUMPPAD_V;
>>
>>        IPhysicsObject *pObj = this->VPhysicsGetObject();
>>    if( pObj)
>>    {
>>       pObj->Wake();
>>        pPhysicsObject->AddVelocity( &velGo, NULL );
>>       }
>>
>>
>>
>>
>> On Tue, May 27, 2008 at 10:46 AM, Tom Leighton 
>> <[EMAIL PROTECTED]>
>> wrote:
>>
>>> IPhysicsObject *pPhys = pPlayer->VPhysicsGetObject();
>>>
>>> There you have your physics object :P
>>>
>>> mastersmith98 wrote:
>>> > I looked at the TriggerPush code and I've picked up two things from 
>>> > it.
>>> >
>>> > 1. I should convert the player pointer to a vphysics object or
>>> > 2, I should I give up hope completely (:P)
>>> >
>>> > now I did find out something interesting. just for the heck of it, I 
>>> > made
>>> a
>>> > mock up weapon and placed pPlayer->setAbsVelocity(
>>> pPlayer->GetAbsVelocity()
>>> > * 40 ); in the primary attack
>>> > function, and to my surprise it flung the player forward. maybe it 
>>> > works
>>> > because the code is being replicated to the client?
>>> >
>>> > I also tried adding pPlayer->setGroundEntity( NULL ); into my jump pad
>>> code
>>> > and that didn't work either.
>>> >
>>> > --------------------------------------------------
>>> > From: "Garry Newman" <[EMAIL PROTECTED]>
>>> > Sent: Monday, May 26, 2008 3:01 PM
>>> > To: "Discussion of Half-Life Programming" <
>>> [email protected]>
>>> > Subject: Re: [hlcoders] Changing the players Velocity?
>>> >
>>> >
>>> >> I think all you need to do is remove the ground entity. I can't
>>> >> remember the exact function - but have a look at how it makes the
>>> >> player jump - should be in there.
>>> >>
>>> >> garry
>>> >>
>>> >> On Mon, May 26, 2008 at 6:46 PM, mastersmith98 
>>> >> <[EMAIL PROTECTED]>
>>> >> wrote:
>>> >>
>>> >>> Unfortunately, it still doesn't work : /
>>> >>>
>>> >>> here's the new code for it.
>>> >>>
>>> >>> void CJumpPad::PlayerTouch( CBaseEntity *pOther )
>>> >>> {
>>> >>>        if( !pOther->IsPlayer() )
>>> >>>                return;
>>> >>>
>>> >>>        CBasePlayer *pPlayer = (CBasePlayer* )pOther;
>>> >>>
>>> >>>        if( pPlayer == NULL )
>>> >>>                return;
>>> >>>
>>> >>>        Msg("just checking");
>>> >>>
>>> >>>        Vector vecJump = GetTouchTrace().plane.normal;
>>> >>>        vecJump.Negate();
>>> >>>        pPlayer->SetAbsVelocity( vecJump * 40 );
>>> >>>
>>> >>>        QAngle angFacing;
>>> >>>        VectorAngles( pPlayer->GetAbsVelocity(), angFacing );
>>> >>>        pPlayer->SetAbsAngles( angFacing );
>>> >>> }
>>> >>>
>>> >>> --------------------------------------------------
>>> >>> From: "Steve Henderson" <[EMAIL PROTECTED]>
>>> >>> Sent: Monday, May 26, 2008 12:40 AM
>>> >>> To: "Discussion of Half-Life Programming"
>>> >>> <[email protected]>
>>> >>> Subject: Re: [hlcoders] Changing the players Velocity?
>>> >>>
>>> >>>
>>> >>>> Try changing the player's heading to match the movement vector:
>>> >>>>
>>> >>>> Add this after your set velocity code:
>>> >>>>
>>> >>>> Vector velFacing = GetAbsVelocity();
>>> >>>> QAngle angFacing;
>>> >>>> VectorAngles( velFacing, angFacing );
>>> >>>> SetAbsAngles( angFacing );
>>> >>>>
>>> >>>>
>>> >>>>
>>> >>>>
>>> >>>> On Mon, May 26, 2008 at 3:19 AM, mastersmith98 
>>> >>>> <[EMAIL PROTECTED]
>>> >
>>> >>>> wrote:
>>> >>>>
>>> >>>>
>>> >>>>> I'm working on a model based jump pad which uses the touch 
>>> >>>>> function
>>> to
>>> >>>>> find
>>> >>>>> out if the player is touching it and then fling them up into the 
>>> >>>>> air.
>>> >>>>> Although the jump pad collides with the player, it can't change 
>>> >>>>> the
>>> >>>>> player's
>>> >>>>> velocity.
>>> >>>>>
>>> >>>>> here's the code for it.
>>> >>>>>
>>> >>>>> void CJumpPad::PlayerTouch( CBaseEntity *pOther )
>>> >>>>>
>>> >>>>> {
>>> >>>>>
>>> >>>>> if( !pOther->IsPlayer() )
>>> >>>>>
>>> >>>>> return;
>>> >>>>>
>>> >>>>> CBasePlayer *pPlayer = (CBasePlayer* )pOther;
>>> >>>>>
>>> >>>>> Vector vecJump = GetTouchTrace().plane.normal;
>>> >>>>>
>>> >>>>> vecJump.Negate();
>>> >>>>>
>>> >>>>> pPlayer->SetAbsVelocity(  44 * vecJump );
>>> >>>>>
>>> >>>>> }
>>> >>>>> _______________________________________________
>>> >>>>> To unsubscribe, edit your list preferences, or view the list
>>> archives,
>>> >>>>> please visit:
>>> >>>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>> _______________________________________________
>>> >>>> To unsubscribe, edit your list preferences, or view the list 
>>> >>>> archives,
>>> >>>> please visit:
>>> >>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>> >>>>
>>> >>>>
>>> >>>>
>>> >>> _______________________________________________
>>> >>> To unsubscribe, edit your list preferences, or view the list 
>>> >>> archives,
>>> >>> please visit:
>>> >>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>> >>>
>>> >>>
>>> >>>
>>> >> _______________________________________________
>>> >> To unsubscribe, edit your list preferences, or view the list 
>>> >> archives,
>>> >> please visit:
>>> >> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>> >>
>>> >>
>>> >>
>>> >
>>> > _______________________________________________
>>> > To unsubscribe, edit your list preferences, or view the list archives,
>>> please visit:
>>> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>> >
>>> >
>>> >
>>>
>>> _______________________________________________
>>> To unsubscribe, edit your list preferences, or view the list archives,
>>> please visit:
>>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>>
>>>
>> _______________________________________________
>> To unsubscribe, edit your list preferences, or view the list archives, 
>> please visit:
>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>>
>>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, 
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
> 

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to