I'm trying to push a Karma object into the right place. Right now, I'm trying to get any reaction whatsoever from this thing.
In the first part, I'm calculating how much to push. It's the wrong number, since I have to get a feel for Karma first, but the direction is correct, since when I just move it, it works fine. Once I get a feel for Karma, I'll just change that part to rotate the direction to the opposite actor.
In the second part, I'm making the actual push. I know it goes into that part because of the log, and when I use move instead of KAddImpulse it works fine.
When I run this code, however, nothing happens. Right now, I'm trying to impulse a ragdoll, if that helps.
Thanks,
PG
In the first part, I'm calculating how much to push. It's the wrong number, since I have to get a feel for Karma first, but the direction is correct, since when I just move it, it works fine. Once I get a feel for Karma, I'll just change that part to rotate the direction to the opposite actor.
In the second part, I'm making the actual push. I know it goes into that part because of the log, and when I use move instead of KAddImpulse it works fine.
When I run this code, however, nothing happens. Right now, I'm trying to impulse a ragdoll, if that helps.
Code:
simulated function constrain() { local float distSquared; local vector delta; //*********** FIRST PART ************ distSquared=((Instigator.Location-victim.Location)Dot Instigator.Location-victim.Location)); if(Role==ROLE_Authority) { log("MaxDistSquared"@maxDistSquared@"vs DistSquared"@distSquared); if(distSquared>maxDistSquared) { //constrain by calculating jerk delta=(Instigator.location)-(victim.location); delta*=(maxDistSquared/((delta dot delta)+maxDistSquared)-0.5); delta*=10000; jerkVictim=-delta; jerkinst=delta; } else { jerkVictim=vect(0,0,0); jerkInst=vect(0,0,0); } } //*********** SECOND PART ************ if(jerkVictim!=vect(0,0,0)) { victim.KWake(); victim.KAddImpulse(jerkVictim, Instigator.location); //Apply the impulse // victim.move(jerkVictim); log("JERK Victim"); } // if(jerkInst!=vect(0,0,0)) Instigator.KAddImpulse(delta, self.location); }
PG
Comment