PDA

View Full Version : Another Third Camera Topic



S ha d
11-14-2009, 06:20 PM
Hello,

Like many, I tried to create to create a Rpg Camera !

The problem ? I'm a noob, and I only partially succeeded with taking inspiration from different sources ... :o

The only problem is shooting which continues to be in the direction of the camera (as you can see on the screen).

Someone has an idea?

http://img41.imageshack.us/img41/4062/rpgcam.jpg

Source :


class RPGController extends UTPlayerController;

//Camera Calculations
var vector LastViewLoc;
var vector CameraOffset;
var vector CameraOffset2;

//Force third-person
function SetBehindView(bool bNewBehindView)
{
super.SetBehindView(true);
}

// RPG Camera (based on Third-Person Camera)
simulated event GetPlayerViewPoint(out vector POVLocation, out Rotator POVRotation)
{
if(ViewTarget != none)
{
LastViewLoc = ViewTarget.Location;
bCollideWorld = true;

}

POVLocation = LastViewLoc + CameraOffset2;
POVRotation = rotator(-CameraOffset);

StopViewShaking();

if(CameraEffect != none)
CameraEffect.UpdateLocation(POVLocation, POVRotation, GetFOVAngle());
}

defaultproperties
{
//Camera
bBehindView=true;
CameraOffset=(X=1,Y=1,Z=1)
CameraOffset2=(X=200,Y=200,Z=300)

}

Thank you !

(Sorry for my bad english ... u_u)

fritzmonkey
11-14-2009, 06:28 PM
You need to change the weapon and have it use the player rotation. I've posted about this in another thread.

TheAgent
11-14-2009, 06:35 PM
how u make it use player rotation? is it in the weapon code? O_O :)

fritzmonkey
11-15-2009, 03:19 AM
Yes, it is in the weapon code.

Chris2009
11-15-2009, 06:48 PM
Did you fix the problem? if not, try this in your PlayerController Class.



function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
return Pawn.Rotation;
}

Frank tj Mackie
11-15-2009, 10:14 PM
Is there an option to adjust the aim so that it follows rotation and vertical movement? as in up\down.

S ha d
11-16-2009, 01:30 AM
Did you fix the problem? if not, try this in your PlayerController Class.



function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
return Pawn.Rotation;
}



Thank you so much man, that works ! ;)

LordsWarrior
11-16-2009, 03:13 AM
Hi S ha D

I want to do very similar to this too, and am also a noob. IVe done it for UNity3d but IM finding UDK a little tricky to work out how every thing connects.

If you are able to provide steps on what youve done from UDK install to setting up a new player (camera view) that would be much appreciated and would help me get the first start point.

I often find the first 2 weeks of an engine a mind melt...but once in with first thing its easy.

Thanks muchly!

-LW

MrWashington
11-16-2009, 03:56 AM
Hi S ha D

I want to do very similar to this too, and am also a noob. IVe done it for UNity3d but IM finding UDK a little tricky to work out how every thing connects.

If you are able to provide steps on what youve done from UDK install to setting up a new player (camera view) that would be much appreciated and would help me get the first start point.

I often find the first 2 weeks of an engine a mind melt...but once in with first thing its easy.

Thanks muchly!

-LWHere's a fairly quick and dirty way of testing this small snippet:

1. After installing the UDK, create a new folder in Developer\Src named RPGCam. Inside that folder make a folder named Classes.

2. Create a new file named RPGController.uc inside the newly created Classes folder containing the fallowing code:
class RPGController extends UTPlayerController;

//Camera Calculations
var vector LastViewLoc;
var vector CameraOffset;
var vector CameraOffset2;

//Force third-person
function SetBehindView( bool bNewBehindView )
{
super.SetBehindView( true );
}

// RPG Camera (based on Third-Person Camera)
simulated event GetPlayerViewPoint( out vector POVLocation, out Rotator POVRotation )
{
if ( ViewTarget != none )
{
LastViewLoc = ViewTarget.Location;
bCollideWorld = true;

}

POVLocation = LastViewLoc + CameraOffset2;
POVRotation = rotator( -CameraOffset );

StopViewShaking();

if ( CameraEffect != none )
CameraEffect.UpdateLocation( POVLocation, POVRotation, GetFOVAngle( ) );
}

// Allows the mouse to still aim weapons
function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
return Pawn.Rotation;
}

defaultproperties
{
//Camera
bBehindView=true;
CameraOffset=(X=1,Y=1,Z=1)
CameraOffset2=(X=200,Y=200,Z=300)
}

3. Create a new file named RPGCamInfo.uc that contains:
class RPGCamInfo extends UTDeathmatch;

static event class<GameInfo> SetGameType(string MapName, string Options, string Portal)
{
return default.class;
}

defaultproperties
{
PlayerControllerClass=class'RPGController'
}


4. Make the file DefaultEngine.ini inside UTGame\Config not Read Only.

5. Inside UTGame\Config open up DefaultEngine.ini. In the section "[UnrealEd.EditorEngine]" add the fallowing line *after* "+EditPackages=UTGameContent":
+EditPackages=RPGCam

6. Delete UTEngine.ini from the UTGame\Config folder.

7. Go to the Binaries folder and run UnrealFrontend.exe.

8. Click the arrow next to "Make" and hit Full Recompile.

9. Open up Command Prompt (go to Run... and type "cmd" and press Enter) and browse to the Binaries\Win32 folder (by typing something like "cd C:\UDK\UDK-2009-11\Binaries\Win32") and type the fallowing to test your new script:
udk dm-deck?game=rpgcam.rpgcaminfo



This is by no means how you would release your content to the public, but it's the easiest way I know to test Unrealscript in the UDK. Although I'm sure there are actually better ways to test script.

Effregy
11-16-2009, 04:14 AM
did you get it to work?

try this in your PlayerController Class
What do you mean by that?
Idk if you realize it, but many people are attempting to get past the pain to change ut3 aiming system, I've spent the last 3 hours attempting to change it.
I only use kismet and property edits though =p
If you found a way to properly do it, please share. I'll give you a cherry pie?

Edit: I just want to know how to do the fixed aiming thing, I already have kismet v.s. of the cameras, wich all have the aiming as the problem, so whats

function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
return Pawn.Rotation;
}
in kismet
pray tell?

Chris2009
11-16-2009, 09:09 AM
You need to learn how to setup the UDK for a Custom Mod, try here :

http://udn.epicgames.com/Three/DevelopmentKitProgramming.html

Once thats done create a PlayerControl class that extends the UTPlayerController class.

and add the function I posted above and voila!

Frank tj Mackie
11-21-2009, 12:31 AM
So I used the


function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
return Pawn.Rotation;
}

and it worked like a dream, only problem though is that I can't shoot up or down, only left and right, any ideas?

srv
11-21-2009, 03:01 AM
You need to make the free cursor and in a code to make check on collision of a trace of the mouse with the ground is there will be a point where the character shoots
Here I asked a question on trace from mouse position on the screen http://forums.epicgames.com/showthread.php?t=708724

Frank tj Mackie
11-21-2009, 08:59 PM
Ok, I'm completely lost going to go do some reading and then come back to this. That code is over my head.