PDA

View Full Version : projectile camera


Donator
9th Jul 2003, 07:57 AM
out of curiousity, can you attach your camera to a projectile without it having to be a 'warhead' (-> subclass of pawn) if you don't actually want to steer the projectile, but only watch where it's going? Would save me some re-coding.

Donator
9th Jul 2003, 10:50 AM
And while we're at it: how could I call the 'BlowUp' function of a projectile from within the weapon code if the player dies? The idea is for a grenade to explode if you're holding it while you're killed.

Smoke39
9th Jul 2003, 02:16 PM
And while we're at it: how could I call the 'BlowUp' function of a projectile from within the weapon code if the player dies? The idea is for a grenade to explode if you're holding it while you're killed.

In Tick you could call 'BlowUp' if Instigator.Health <= 0, or you might be able to do that in the weapon thrown function or whatever it's called. To make the explosion, you could copy all the explosion code from the projectile into your weapon and just change it's location to Instigator.Location.

As for your first question, SetViewTarget() in PlayerController works on all actors. You could have you weapon spawn the proj, then

if ( PlayerController(Instigator.Controller) != None )
{
PlayerController(Instigator.Controller).SetViewTarget(proj);
}

Donator
10th Jul 2003, 01:04 AM
Wow. thanks. Seeing the world through the eyes of a Flak shell is just ingenious :p

Donator
10th Jul 2003, 03:04 AM
Just got the grenade to work. Modified the DropFrom() function to spawn a projectile instead of a pickup if health<0. and since the collision detection takes the ragdoll for a target it blows up instantly, as planned. neat. it's now pretty rewarding for a sniper to pick out the guy with the grenade in the midst of a flag-atttacking mob :D

beer me
12th Aug 2003, 06:41 PM
I don't mean to bring back a old topic but i actually want to do the opposite of this

--------------------------------------------------------------------------------
if ( PlayerController(Instigator.Controller) != None )
{
PlayerController(Instigator.Controller).SetViewTarget(proj);
}

I am workign with the redeemer alt fire and i want to be able to control the projectile like normal but i don't want the camera to go to the projectile once it is fired. I want the camera to stay with the player, but still be able to control the projectile liek normal...

Smoke39
12th Aug 2003, 07:53 PM
In the projectile's Tick function put

SetRotation( Instigator.GetViewRotation() );
Velocity = Speed*vector(Rotation);

and that should do it.

beer me
13th Aug 2003, 10:33 AM
Here is the tick function in the warhead class i wasn't sure where exactly o put it but you can see where i put it, i am getting a error saying bad or missing expression in '=' and this line is highlighted Velocity = Speed*vector(Rotation); I tried changin Speed To AirSpeed and it compiles ok, but the camera is still on the end of the projectile and not with the player :(

auto state Flying
{
function Tick(float DeltaTime)
{
SetRotation( Instigator.GetViewRotation() );
Velocity = Speed*vector(Rotation);


if ( !bFireForce && (PlayerController(Controller) != None) )
{
bFireForce = true;
PlayerController(Controller).ClientPlayForceFeedback("FlakCannonAltFire"); // jdf
}
if ( (OldPawn == None) || (OldPawn.Health <= 0) )
BlowUp(Location);
else if ( Controller == None )
{
if ( OldPawn.Controller == None )
OldPawn.KilledBy(OldPawn);
BlowUp(Location);
}
}
}

Smoke39
13th Aug 2003, 02:54 PM
You didn't tell me you were simply modifying the 'deemer. It didn't compile 'cause the warhead is a subclass of Pawn rather than projectile, so it doesn't have a speed variable. I don't know precisely how the 'deemer works, so I can't offer you a tremendous amount of help. If I were you I'd make my own weapon and projectile, rather than modify the 'deemer.

beer me
23rd Aug 2003, 08:01 PM
sorry for the late reply, i am goign through 2 a days forfootball..any way the reason i went with the reedemer is because i want to beable to control the weapon like the redeemer, jsut from a 3 rd person point of view..but i guess i can jsut use a new projectile instead of the warhead..