Best way to simulate a kill-cam?

Post » Wed Jan 23, 2013 5:22 am

I've come up with something, but maybe there's a more elegant answer somewhere in one of your heads.

Basically I want to have a camera follow a big projectile into a pipe, which then explodes destroying a wall.

What I've come up with is the following. Make an invisible race actor with a very high running speed and put him in a holding cell. OnActivate on the thing that fires the projectile, play a major slow time effect. Potentially one that slows time a lot at first, and gradually wears off. The invisible actor is moved to the launch point, or close to, the moment before take-off and a SetCameraTarget() done on him. The projectile fires.
The invisible actor has been set up with a package that makes him run towards the point on the pipe where the impact will happen. The actor and bolt reach the impact point at roughly the same time. Slow time stops, explosion plays. Done.

I may use SetPlayerControlled on the invisible actor, as he has a package anyway that should prevent the player from doing anything...untoward.
Anyone have another idea?
User avatar
jessica breen
 
Posts: 3524
Joined: Thu Aug 03, 2006 1:04 am

Post » Tue Jan 22, 2013 10:20 pm

In my testing for cinematic camera sweeps, I did something similar. I spawned an invisible actor (call it Camera), disable its AI (which allows it to be translated without falling or glitching), turned off the HUD, player controls, etc, set Camera as the camera target and forced 1st-person mode. Now I can Translate and SplineTranslate Camera around, and the player will basically see of out of it's "eyes". If you set the player as AI-controlled you can play packages on it to create cinematics while using what's basically a Lakitu-cam, which was my goal. In your case, I'd just translate Camera along a path that follows your projectile's angle and velocity, with a starting and finishing angle that keeps it aimed at the projectile. That should give you a nice, smooth shot.

Two downsides to my method:
1. Player can still use the mousewheel or F to "zoom out" of the Camera actor, which kind of messes with the perspective. I couldn't find a way to disable this.
2. If you want to use the slow-time effect, you might have to tweak the Translate velocity; I'm not sure it's properly affected by the timescale.
User avatar
Bedford White
 
Posts: 3307
Joined: Tue Jun 12, 2007 2:09 am

Post » Tue Jan 22, 2013 10:16 pm

Thanks, will be working on this later. Probably put up a video (if I can get Fraps working properly).
User avatar
ChloƩ
 
Posts: 3351
Joined: Sun Apr 08, 2007 8:15 am

Post » Wed Jan 23, 2013 4:53 am

What's annoying is there are quite a few potentially useful camera track sequences already in the CK, but they appear to only work during a killshot. I tried for quite some time to trigger them in other ways or construct my own, all to no avail.
User avatar
A Lo RIkIton'ton
 
Posts: 3404
Joined: Tue Aug 21, 2007 7:22 pm

Post » Wed Jan 23, 2013 3:51 am

Hmmm. I'm doing something wrong here. I've tried a couple of different ways of projecting the player into the Camera actor's eyes, and none of it is working. I have verified that my propertries are declared...

Spoiler

Scriptname PCKP_Script_DweBallista extends TrapBase;;Dart Trap extending TrapBase;integrated with the TrapTriggerBase;;================================================================import debug	import utilityimport customint property shotCount = 3 auto{This property track the ammo that the ballista has, and starts with};int numShots = 20			;might want to make this a propertyfloat fireRate = 0.1float property initialDelay = 0.0 autoweapon property ballistaWeaponM autoweapon property ballistaWeaponL autoweapon property ballistaWeaponR autobool property fireAllShots = True auto{if this is true all three shots will be fired at once}bool property isFiring auto hiddenbool property isLoaded auto hiddenbool property shotFired = false auto hiddenbool property weaponResolved = false auto hiddenSpell property TimeSLow autoActor CameraActorBase Property Invis autoObjectReference Property InitialXMarker autoObjectReference Property FinalXMarker autoObjectReference Property StorageXMArker autofloat Property InvisSpeed autoFunction initialize()	endFunctionFunction ResetLimiter()	shotFired = false		;shotCount is scoped outside of the OnActivate blocks. This will reset scopecount to 0, extending the firing time.EndFunctionFunction fireTrap()	if !TrapDisarmed		isFiring = True		objectReference TrapSelf = self as objectReference		if !weaponResolved			ResolveLeveledWeapon()		endif		while !weaponResolved		;Do not fire till weapon is resolved		endWhile		;TRACE("fireTrap called")		WindupSound.play( self as ObjectReference)		;play windup sound		wait( initialDelay )		;wait for windup		; if (fireOnlyOnce == True)	;If this can be fired only once then disarm			; trapDisarmed = True		; endif				while(shotcount &--#62; 0) && !shotfired && isLoaded			if fireAllShots				TimeSlow.Cast(Game.GetPlayer())			   Camera = (Game.GetPlayer().PlaceAtMe(Invis) as Actor)   ; this is the actual steadicam function   Game.ForceThirdPerson()   Game.SetCameraTarget(Camera)   Game.SetPlayerAIDriven(True)   Game.DisablePlayerControls() ; or use whatever set of booleans that you need, i just used these cause i was messing around with the possession effect)   Game.SetHUDCartMode(True)   Game.SetInChargen(True, True, False)				;Invis.EnableAI(false)								playAnimation("TriggerAll")			 ;fire all				ballistaWeaponM.fire( TrapSelf, ballistaAmmo )		;fire 01				ballistaWeaponL.fire( TrapSelf, ballistaAmmo )		;fire 02				ballistaWeaponR.fire( TrapSelf, ballistaAmmo )		;fire 03				Camera.TranslateToRef(FinalXMarker, afSpeed = InvisSpeed)				Utility.Wait(1)				Game.SetCameraTarget(Game.GetPlayer())				Game.EnablePlayerControls()				Game.SetHUDCartMode(false)				Game.SetInCHargen(false, false, false)							shotcount -= 3				WaitForAnimationEvent("FTransAll")								;playAnimationAndWait("ResetAll","RTransAll")				 ;reset anim all			else				if shotCount == 3					playAnimation("Trigger01")		;fire anim 01					ballistaWeaponM.fire( TrapSelf, ballistaAmmo )	;fire 01					shotcount -= 1					WaitForAnimationEvent("FTrans01")					playAnimationAndWait("Reset01","RTrans01")			;reset anim 01				elseIf ShotCount == 2					playAnimation("Trigger02")		;fire anim 02					ballistaWeaponL.fire( TrapSelf, ballistaAmmo )	;fire 02					shotcount -= 1					WaitForAnimationEvent("FTrans02")					playAnimationAndWait("Reset02","RTrans02")			;reset anim 02				elseIf ShotCount == 1					playAnimation("Trigger03")		;fire anim 03					ballistaWeaponR.fire( TrapSelf, ballistaAmmo )	;fire 03					shotcount -= 1					WaitForAnimationEvent("FTrans03")					;playAnimationAndWait("Reset03","RTrans03")			 ;reset anim 03				endIf			endIf			shotFired = True				if (loop == TRUE)			;Reset Limiter				resetLimiter()			endif					endWhile				if isLoaded				isFiring = false			;playAnimation("idle")			goToState("Reset")		endif			endif	endFunctionState Reset	Event OnBeginState()		;TRACE("State Reset")		if shotcount &--#62; 0			;shotCount = 3			GoToState ( "Idle" )		Else			TrapDisarmed = True			GoToState ("Disabled")		endif			endEvent		Event OnActivate( objectReference activateRef )	;TRACE("Reset trigger")	EndEvent	endState;-----------------------------------------------int property LvlThreshold1 autoint property LvlThreshold2 autoint property LvlThreshold3 autoint property LvlThreshold4 autoint property LvlThreshold5 autoammo property ballistaAmmo autoammo property TrapDweBallistaBoltAmmo01 autoammo property TrapDweBallistaBoltAmmo02 autoammo property TrapDweBallistaBoltAmmo03 autoammo property TrapDweBallistaBoltAmmo04 autoammo property TrapDweBallistaBoltAmmo05 autoammo property TrapDweBallistaBoltAmmo06 autoFunction ResolveLeveledWeapon ()	;Trace("ResolveLeveledWeapon")	int damageLevel	damageLevel = CalculateEncounterLevel(TrapLevel)		; weapon lvlWeaponM = LvlWeaponM1	; weapon lvlWeaponL = LvlWeaponL1	; weapon lvlWeaponR = LvlWeaponR1	Ammo LvlAmmo = TrapDweBallistaBoltAmmo01		if (damageLevel &--#62; LvlThreshold1 && damageLevel &--#60;= LvlThreshold2)		; lvlWeaponM = LvlWeaponM2		; lvlWeaponL = LvlWeaponL2		; lvlWeaponR = LvlWeaponR2		LvlAmmo = TrapDweBallistaBoltAmmo02		;Trace("damage threshold =")		;Trace("2")	endif	if (damageLevel &--#62; LvlThreshold2 && damageLevel &--#60;= LvlThreshold3)		;lvlWeaponM = LvlWeapon3		LvlAmmo = TrapDweBallistaBoltAmmo03		;Trace("damage threshold =")		;Trace("3")	endif	if (damageLevel &--#62; LvlThreshold3 && damageLevel &--#60;= LvlThreshold4)		;lvlWeaponM = LvlWeapon4		LvlAmmo = TrapDweBallistaBoltAmmo04		;Trace("damage threshold =")		;Trace("4")	endif	if (damageLevel &--#62; LvlThreshold4 && damageLevel &--#60;= LvlThreshold5)		;lvlWeaponM = LvlWeapon5		LvlAmmo = TrapDweBallistaBoltAmmo05		;Trace("damage threshold =")		;Trace("5")	endif	if (damageLevel &--#62; LvlThreshold5)		;lvlWeaponM = LvlWeapon6		LvlAmmo = TrapDweBallistaBoltAmmo06		;Trace("damage threshold =")		;Trace("6")	endif		; ballistaWeaponM = lvlWeaponM	; ballistaWeaponL = lvlWeaponL	; ballistaWeaponR = lvlWeaponR	BallistaAmmo = LvlAmmo	weaponResolved = TrueEndFunctionevent onLoad()	isLoaded = TRUE	if isFiring == True		fireTrap()	endif	if shotCount == 3		playAnimationAndWait("Reset03","RTrans03")			;reset anim 01	elseIf ShotCount == 2		playAnimationAndWait("Reset01","RTrans01")			;reset anim 02	elseIf ShotCount == 1		playAnimationAndWait("Reset02","RTrans02")			;reset anim 02	endIfEndEventevent onUnload();	 debug.Trace(self + " has recieved onUnload event")	isLoaded = FALSEendEvent



The relevant code is inside the if FireAllShots part of the firing sequence. Basically time slows down, the projectiles fire, hit, explode, time returns to normal. Likewise player controls are disabled and re-enabled at the appropriate times. What's troubling is that anything to do with Invis doesn't work. I can't see out of his eyes, heck I can't even make the camera target him. It can't be just because he's invisible right?

EDIT: Got it mostly working, but the camera only works for about half a second, then control switches back to the player. Have to figure out the deal there.
EDIT2: Sometimes I forget that translations are not latent functions. BTW translations are slowed by slow time spells, which is nice.
User avatar
joannARRGH
 
Posts: 3431
Joined: Mon Mar 05, 2007 6:09 am

Post » Wed Jan 23, 2013 1:12 am

So you're in good shape, then? What was wrong before edit 1?
User avatar
hannah sillery
 
Posts: 3354
Joined: Sun Nov 26, 2006 3:13 pm

Post » Tue Jan 22, 2013 5:32 pm

So you're in good shape, then? What was wrong before edit 1?

I forgot Translation was not latent. Basically I had the dude translating, but didn't wait for him to get there before switching back to the player.

And yeah, it works, and it is glorious.
User avatar
Richard Thompson
 
Posts: 3302
Joined: Mon Jun 04, 2007 3:49 am


Return to V - Skyrim