Community News Licensing Documentation Showcase Features Download UDK.com  
Old 11-14-2009, 06:20 PM   #1
S ha d
Member
 
Join Date: Nov 2009
Location: Rennes, France
Posts: 40
Default Another Third Camera Topic

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 ...

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?



Source :
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());
}

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)
S ha d is offline   Reply With Quote
Old 11-14-2009, 06:28 PM   #2
fritzmonkey
Senior Member
 
Join Date: Apr 2009
Posts: 102
Default

You need to change the weapon and have it use the player rotation. I've posted about this in another thread.
fritzmonkey is offline   Reply With Quote
Old 11-14-2009, 06:35 PM   #3
TheAgent
Senior Member
 
TheAgent's Avatar
 
Join Date: Aug 2008
Location: Location,Location
Posts: 924
Send a message via AIM to TheAgent
Default

how u make it use player rotation? is it in the weapon code? O_O
__________________
My Website
This is a revolution...
ITE Trash Bot Game
HyberiasFinal
TheMovingFinal
CTF-GRD-17Beta
TheAgent is offline   Reply With Quote
Old 11-15-2009, 03:19 AM   #4
fritzmonkey
Senior Member
 
Join Date: Apr 2009
Posts: 102
Default

Yes, it is in the weapon code.
fritzmonkey is offline   Reply With Quote
Old 11-15-2009, 06:48 PM   #5
Chris2009
Member
 
Chris2009's Avatar
 
Join Date: Nov 2009
Location: Uk, south England
Posts: 75
Default

Did you fix the problem? if not, try this in your PlayerController Class.


Code:
function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
     return Pawn.Rotation;
}
Chris2009 is offline   Reply With Quote
Old 11-15-2009, 10:14 PM   #6
Frank tj Mackie
Junior Member
 
Join Date: Nov 2009
Posts: 9
Default

Is there an option to adjust the aim so that it follows rotation and vertical movement? as in up\down.
Frank tj Mackie is offline   Reply With Quote
Old 11-16-2009, 01:30 AM   #7
S ha d
Member
 
Join Date: Nov 2009
Location: Rennes, France
Posts: 40
Default

Quote:
Originally Posted by Chris2009 View Post
Did you fix the problem? if not, try this in your PlayerController Class.


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

Thank you so much man, that works !
S ha d is offline   Reply With Quote
Old 11-16-2009, 03:13 AM   #8
LordsWarrior
Senior Member
 
Join Date: Nov 2009
Location: Wellington , New Zealand
Posts: 105
Default

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
LordsWarrior is offline   Reply With Quote
Old 11-16-2009, 03:56 AM   #9
MrWashington
Junior Member
 
Join Date: Nov 2009
Posts: 7
Default

Quote:
Originally Posted by LordsWarrior View Post
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
Here'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:
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:
Code:
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":
Code:
+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:
Code:
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.
MrWashington is offline   Reply With Quote
Old 11-16-2009, 04:14 AM   #10
Effregy
Junior Member
 
Effregy's Avatar
 
Join Date: Nov 2009
Posts: 28
Default

did you get it to work?
Quote:
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
Quote:
function rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc)
{
return Pawn.Rotation;
}
in kismet
pray tell?
__________________
Step by weary step... I trudge along a path I force out of the static-lifeless-emissent crowd of metaphorical npc's that dot the landscape.

Last edited by Effregy; 11-16-2009 at 04:37 AM.
Effregy is offline   Reply With Quote
Reply

Thread Tools
Display Modes


All times are GMT -4. The time now is 10:18 PM.


Powered by vBulletin
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2009-2010 Epic Games, Inc. All Rights Reserved.
Video Game Voters Network