Results 1 to 2 of 2
  1. #1
    MSgt. Shooter Person
    Join Date
    Jan 2010
    Location
    Tokyo, JAPAN
    Posts
    34

    Default プラットフォーマーキットでのカメラワーク制御について

    前回モデリングではお世話になりました。
    miyayukです。

    現在はプラットフォーマーキットを参考にUnrealScriptを勉強中です。

    http://udn.epicgames.com/Three/Devel...rterKitJP.html

    そこで質問なのですが、このプラットフォーマーキット内でカメラワークを制御したいのですが、
    現状はサンプルと同様にUpdateViewTarget()をオーバーライドしているだけな ので
    色々処理を追加していくことは想像つくのですが
    どこから手をつけて行けば良いのか検討がついてない状態です。

    実現したいこととして

    ・左端/右端にプレイヤーが到達したらカメラはプレイヤーに追従せずその場で停止させる。それ以外ではプレイヤーに 追従。
    ・画面上部にプレイヤーが昇ってきたら、カメラを縮小させたい。

    などを想定しております。

    上記のきっかけ部分はBlockingVolume / TriggerVolumeで行うと思っておりますが
    それをどのようにUnrealScript側へ伝えて行けば良いのか検討ついてない感じです。

    何かアドバイスや参考となるページの情報をお持ちの方がおりましたら
    返信頂けると幸いです。よろしくお願いします。

  2. #2
    MSgt. Shooter Person
    Join Date
    Jan 2010
    Location
    Tokyo, JAPAN
    Posts
    34

    Default

    とりあえず自己解決したので
    実装した方法を記載させて頂きます。

    何かの参考なればと思いつつ、
    他の良い方法などアドバイス頂けると幸いです。

    まずは、サンプルのカメラクラスを以下のように変更しました。
    ※ちなみに別プロジェクトで作成しているためクラス名はオリジナルのものにしてあります

    ActTwoSide_Camera.uc
    Code:
    class ActTwoSide_Camera extends Camera;
    
    var const archetype ActTwoSide_CameraProperties CameraProperties;
    
    /**
     * Updates the camera's view target. Called once per tick
     *
     * @param	OutVT		Outputted camera view target
     * @param	DeltaTime	Time since the last tick was executed
     */
    function UpdateViewTarget(out TViewTarget OutVT, float DeltaTime)
    {
    	local CameraActor	CamActor;
    
    	// Early exit if:
    	// - We have a pending view target
    	// - OutVT currently equals ViewTarget
    	// - Blending parameter is lock out going
    	if (PendingViewTarget.Target != None && OutVT == ViewTarget && BlendParams.bLockOutgoing)
    	{
    		return;
    	}
    
    	// Default FOV on viewtarget
    	OutVT.POV.FOV = CameraProperties.CameraFOV;
    
    	// Viewing through a camera actor.
    	CamActor = CameraActor(OutVT.Target);
    	if( CamActor != None )
    	{
    		CamActor.GetCameraView(DeltaTime, OutVT.POV);
    
    		// Grab aspect ratio from the CameraActor.
    		bConstrainAspectRatio	= bConstrainAspectRatio || CamActor.bConstrainAspectRatio;
    		OutVT.AspectRatio		= CamActor.AspectRatio;
    
    		// See if the CameraActor wants to override the PostProcess settings used.
    		CamOverridePostProcessAlpha = CamActor.CamOverridePostProcessAlpha;
    		CamPostProcessSettings = CamActor.CamOverridePostProcess;
    	}
    	else
    	{
    
    		// ターゲット位置にカメラプロパティ値を加えて戻り値の OutVTの位置に設定する
    		// 但し、ジャンプ時に縦へスクロールさせたくないので Z値はカメラプロパティ値のみ設定している
    		//OutVT.POV.Location = OutVT.Target.Location + CameraProperties.CameraOffset;
    		if(CameraProperties.bFollowToPlayer){
    			OutVT.POV.Location.X = OutVT.Target.Location.X + CameraProperties.CameraOffset.X;
    			OutVT.POV.Location.Y = OutVT.Target.Location.Y + CameraProperties.CameraOffset.Y;
    			OutVT.POV.Location.Z = CameraProperties.CameraOffset.Z;
    		}
    		// ターゲットの方向へカメラを向けるようにする
    		// ※昔の横2Dスクロールゲームらしくカメラを真正面に向かせるためにコメントアウトしている
    		//OutVT.POV.Rotation = Rotator(OutVT.Target.Location - OutVT.POV.Location);
    	}
    }
    
    defaultproperties
    {
    	CameraProperties=ActTwoSide_CameraProperties'ActTwoSideScrollGameContent.Archetypes.CameraProperties'
    }
    それとプレイヤーが左右端に到達した場合の処理は
    TriggerとKismetで実現しました。


    実行時の動画は以下になります。
    http://www.youtube.com/watch?v=UwtSwAlETf8

    とりあえず左右端でのカメラ制御は実現出来ましたが
    もっとスマートなやり方があるのではないかと思っております。。。


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.