When you set the parent on the object it adds a shadow controller to the
physics object so it can follow the motion.
When you unset the parent you need to either remove the shadow
controller or recreate the vphysics object (destroy it and call
VPhysicsInitNormal() again)

So the easiest fix is probably just

item->VPhysicsGetObject()->RemoveShadowController();
> > >    item->SetMoveType( MOVETYPE_VPHYSICS );


and leave out all of the other ->Enable...() calls

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul Peloski
Sent: Wednesday, December 12, 2007 1:51 PM
To: [email protected]
Subject: Re: [hlcoders] Back from FollowEntity

--
[ Picked text/plain from multipart/alternative ]
#include "player_pickup.h"

flag->Teleport( desired_origin, desired_angles, NULL );

Pickup_OnAttemptPhysGunPickup( flag, player, PICKED_UP_BY_CANNON );
physcannon->AttachObject( flag, desired_origin );

Try that.. I think it fixed the issue but I can't remember.

Regards,

Paul

On Dec 12, 2007 4:27 PM, Janek <[EMAIL PROTECTED]> wrote:

> --
> [ Picked text/plain from multipart/alternative ]
> Paul,
>
> Thank you very much. It is working very well. Now I have gravity.
>
> But I now encoutered another weird problem (it was also accuring
before I
> tried your code). Here is the problem:
> it is like the flag is not at the position I am when attaching it to
the
> gravgun. I see the flag coming from a long distance and attaching to
> gravgun. I noticed it is coming from the position where I executed
> FollowEntity(player) for the first time. It is really strange.
> I can probably manage this problem by setting EF_NODRAW and removing
this
> flag when it is really near gravgun but it is really strange.
>
> I will try to understand why it happens.
>
> Btw, Paul, thank you again for your help. I really appreciate.
>
>
> 2007/12/12, Paul Peloski <[EMAIL PROTECTED]>:
> >
> > --
> > [ Picked text/plain from multipart/alternative ]
> > IPhysicsObject *phys= VPhysicsGetObject();
> >
> > phys->EnableMotion( true );
> > phys->EnableGravity( true );
> > phys->EnableCollisions( true );
> > phys->Wake();
> >
> > One of those should do it, taken from some old hl2ctf code that
moved
> the
> > flag from a bonmerge follow to your gravity gun.
> >
> > Regards,
> >
> > Paul
> >
> > On Dec 12, 2007 1:07 PM, Janek <[EMAIL PROTECTED]> wrote:
> >
> > > --
> > > [ Picked text/plain from multipart/alternative ]
> > > Hi,
> > >
> > > I am encountering a weird problem using "FollowEntity".
> > >
> > > My mod is HL2MP based and is using gravgun.
> > >
> > > When a player is holding an item (CPhysicsPropRepsawnable) with
> gravgun,
> > > he
> > > can use "reload" key to make it following the holder. To do that I
> use:
> > >    ForceDrop();
> > >    item->FollowEntity( player );
> > > It is working well.
> > >
> > > When a player has a following entity and active weapon is gravgun,
he
> is
> > > able to press "reload" key again to make following entity held by
> > gravgun.
> > > To do that I proceed as follow :
> > >    item->FollowEntity( NULL ); // or StopFollowingEntity which
results
> > the
> > > same
> > >    item->SetMoveType( MOVETYPE_VPHYSICS ); // cos previous method
set
> > move
> > > type to movetype_none
> > >    Vector forward;
> > >    ((CBasePlayer *)GetOwner())->EyeVectors( &forward );
> > >    Vector pos = GetOwner()->Weapon_ShootPosition() + forward * 50;
> > >    AttachObject( item, pos );
> > >    item->SetMoveType( MOVETYPE_VPHYSICS );
> > > It is working well BUT when I use secondaryattack of gravgun to
drop
> my
> > > item, it doesn't drop. It is exactly like there is no mass, or
gravity
> > > effect. I tried "item->SetGravity(1.0f);
> > > item->SetMoveType(MOVETYPE_FLYGRAVITY);"
> > > but it hasn't got what I want.
> > > I just want item falling to floor as usual.
> > >
> > > Any idea on this problem ?
> > >
> > > --
> > > -------------------
> > > [EMAIL PROTECTED]
> > > --
> > >
> > > _______________________________________________
> > > 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
> >
> >
>
>
> --
> -------------------
> [EMAIL PROTECTED]
> --
>
> _______________________________________________
> 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