UDK Environmental Artist - for UnrealPHD
Youtube channel for latest tests on UDK: http://www.youtube.com/user/jmprsh153?feature=mhee
Online Portfolio: http://parishproductionmedia.moonfruit.com/
yes it helps in wht i wana do but nw d problem is that whnever i press A and D to move the player move towards and away from camera respectivly.......what should i change in controller code so it wont happen and also i want to strafe right and left instead of player to face towards it and move
Hello guys. I read all the 17 pages and tried all the methods and I cant see the robot on screen. Something has to be working because I can adjust the zoom level using the mouse wheel.
This is my code
PHP Code:class AnotherTestGameInfo extends GameInfo;
DefaultProperties
{
PlayerControllerClass = class 'AnotherTest.AnotherTestActionPlayerController' //Setting the Player Controller to your custom script
DefaultPawnClass = class 'AnotherTest.AnotherTestActionPawn' //Setting the Pawn to your custom script
}
PHP Code:class AnotherTestActionPawn extends UTPawn;
var float CamOffsetDistance; //distance to offset the camera from the player in unreal units
var float CamMinDistance, CamMaxDistance;
var float CamZoomTick; //how far to zoom in/out per command
var float CamHeight; //how high cam is relative to pawn pelvis
//override to make player mesh visible by default
simulated event BecomeViewTarget( PlayerController PC )
{
local UTPlayerController UTPC;
Super.BecomeViewTarget(PC);
if (LocalPlayer(PC.Player) != None)
{
UTPC = UTPlayerController(PC);
if (UTPC != None)
{
//set player controller to behind view and make mesh visible
UTPC.SetBehindView(true);
SetMeshVisibility(UTPC.bBehindView);
//Show Crosshair = false, hide = true
UTPC.bNoCrosshair = false;
}
}
}
//orbit cam, follows player controller rotation
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector HitLoc,HitNorm, End, Start, vecCamHeight;
vecCamHeight = vect(-20,20,0);
vecCamHeight.Z = CamHeight;
Start = Location;
End = (Location+vecCamHeight)-(Vector(Controller.Rotation) * CamOffsetDistance); //cam follow behind player controller
out_CamLoc = End;
//trace to check if cam running into wall/floor
if(Trace(HitLoc,HitNorm,End,Start,false,vect(12,12,12))!=none)
{
out_CamLoc = HitLoc + vecCamHeight;
}
return true;
}
simulated function CamZoomIn()
{
if(CamOffsetDistance > CamMinDistance) CamOffsetDistance-=CamZoomTick;
}
simulated function CamZoomOut()
{
if(CamOffsetDistance < CamMaxDistance) CamOffsetDistance+=CamZoomTick;
}
defaultproperties
{
CamHeight = 50.0
CamMinDistance = 60.0
CamMaxDistance = 350.0
CamOffsetDistance=250.0
CamZoomTick=20.0
}
Is this the correct way to load the game info?(pic)PHP Code:class AnotherTestActionPlayerController extends UTPlayerController;
//Update player rotation when walking
state PlayerWalking
{
ignores SeePlayer, HearNoise, Bump;
function ProcessMove(float DeltaTime, vector NewAccel, eDoubleClickDir DoubleClickMove, rotator DeltaRot)
{
local Vector tempAccel;
local Rotator CameraRotationYawOnly;
if( Pawn == None )
{
return;
}
if (Role == ROLE_Authority)
{
// Update ViewPitch for remote clients
Pawn.SetRemoteViewPitch( Rotation.Pitch );
}
tempAccel.Y = PlayerInput.aStrafe * DeltaTime * 100 * PlayerInput.MoveForwardSpeed;
tempAccel.X = PlayerInput.aForward * DeltaTime * 100 * PlayerInput.MoveForwardSpeed;
tempAccel.Z = 0; //no vertical movement for now, may be needed by ladders later
//get the controller yaw to transform our movement-accelerations by
CameraRotationYawOnly.Yaw = Rotation.Yaw;
tempAccel = tempAccel>>CameraRotationYawOnly; //transform the input by the camera World orientation so that it's in World frame
Pawn.Acceleration = tempAccel;
Pawn.FaceRotation(Rotation,DeltaTime); //notify pawn of rotation
CheckJumpOrDuck();
}
}
//Controller rotates with turning input
function UpdateRotation( float DeltaTime )
{
local Rotator DeltaRot, newRotation, ViewRotation;
ViewRotation = Rotation;
if (Pawn!=none)
{
Pawn.SetDesiredRotation(ViewRotation);
}
// Calculate Delta to be applied on ViewRotation
DeltaRot.Yaw = PlayerInput.aTurn;
DeltaRot.Pitch = PlayerInput.aLookUp;
ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );
SetRotation(ViewRotation);
NewRotation = ViewRotation;
NewRotation.Roll = Rotation.Roll;
if ( Pawn != None )
Pawn.FaceRotation(NewRotation, deltatime); //notify pawn of rotation
}
exec function NextWeapon()
{
AnotherTestActionPawn(Pawn).CamZoomOut();
}
exec function PrevWeapon()
{
AnotherTestActionPawn(Pawn).CamZoomIn();
}
DefaultProperties
{
}
http://imgur.com/nZILZ
Thanks.
Hi,
I'm asking here because I used that type of camera. I'd like to control the camera rotation (left and right) with the left stick on the Xbox 360 controller.
But I don't know where I can change that, I don't find it int the DefaultInput.ini nor in the camera code. Maybe i'm missing it
Thanks for any help !
And thanks for the code, it works great
How do you slightly move the camera to the right of the player to give a third person shooter kinda look? I tried many possibilities but the rotation was messed up though the offset was in proper place
Hello, I have ran into a bit of a wall when using this script - I'm attempting to use the original version of the script on page1. It just appears to give me the default in-game settings of GameInfo, The steps I have taken include
1. Created this folder "UDK-2012-10\Development\Src\ActionGame\Classes" and placed "ActionPawn.uc" + "ActionPlayerController.uc" inside with the respective code.
2. Edited "DefaultEngine.ini" to include "+ModEditPackage=ActionGame" (Also tried +EditPackages=ActionGame for what its worth) as the last entry under the field [UnrealEd.EditorEngine]
3. Deleted UDKEngine.ini, closed everything and recompiled all scripts without error. (Only a warning message telling me theres nothing in MyMods which is from a previous script)
4. Open UDK navigate to world properties change PIE to gameinfo (Do not see anything resembling "ActionGame"), run the game and it just gives me the floating character with no UI.
Those are the steps Ive taken, If i have missed something could anyone fill me in? Would be greatly appreciated!
Thanks in advance
Edit: Forget to add the class, Whoops! :3
class ActionGame extends UTDeathMatch;
defaultproperties
{
DefaultPawnClass=class'ActionGame.ActionPawn'
PlayerControllerClass=class'ActionGame.ActionPlaye rController'
MapPrefixes[0]="Action"
}
Last edited by flethgin; 12-13-2012 at 02:40 AM. Reason: Resolved:
Hey. i somehow got the scripts working with my own files, but when i try running just the code you have, the mesh appears invisible. Everything compiles fine, and this bit of code:
UTPC.SetBehindView(true);
SetMeshVisibility(UTPC.bBehindView);
UTPC.bNoCrosshair = true;
should make it visible correct? If someone could help me on this, i would appreciate it.
I have the same problem. Everything compiles perfectly but the Mesh is not visible.
...doesn't work.Code://override to make player mesh visible by default simulated event BecomeViewTarget( PlayerController PC ) { local UTPlayerController UTPC; Super.BecomeViewTarget(PC); UTPC = UTPlayerController(PC); if (UTPC != None) { //set player controller to behind view and make mesh visible UTPC.SetBehindView(true); SetMeshVisibility(UTPC.bBehindView); UTPC.bNoCrosshair = true; } }
Anyone can help?
Hi.. I saw this post and tried to used this codes.. but when I compile it says "error. in the ControllerPlayer class, "var" can't be use here" .. what could this be?![]()
I'm having the same problem of the mesh not showing up. I wonder if its something with the newest UDK build.
@Carmy_Angel:
Make sure all of your variables (var) in the class file are at the top of your script right under the "class ClassName extends ClassName" header for the .uc file thats throwing the error.
This should fix your problem.![]()
Hi guys, i have one small problem. If i extend my game from UTGame, all this camera code isn't working, it seems like the PlayerControllerClass and DefaultPawnClass are completely ignored, i just get the UTGame default First Person Camera. Like this:
Code:class TestGame extends UTGame; //this doesn't work, TestPlayerController and TestPawnClass ignored defaultproperties { PlayerControllerClass=class'Test.TestPlayerController' DefaultPawnClass=class'Test.TestPawn' }
But if i extend the class from UDKGame i can see that the camera is working correctly (i set my own custom mesh). The reason why i want to extend it from UTGame is because i want to quickly get access to gun and to see how my camera behaves while firing weapons.
Thanks.Code:class TestGame extends UDKGame; //when extending from UDKGame it works defaultproperties { PlayerControllerClass=class'Test.TestPlayerController' DefaultPawnClass=class'Test.TestPawn' }
PS help for the guys who can't see their mesh: I couldn't see it as well, but i solved it by specifying the mesh i want to be displayed by putting this in the Pawn class, default properties
Code:defaultproperties { CamHeight = 40.0 CamMinDistance = 40.0 CamMaxDistance = 350.0 CamOffsetDistance=250.0 CamZoomTick=20.0 Begin Object Class=SkeletalMeshComponent Name=UNCSkeletalMeshComponent SkeletalMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.SK_CH_IronGuard_MaleA' AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human' AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale' PhysicsAsset=PhysicsAsset'CTF_Flag_IronGuard.Mesh.S_CTF_Flag_IronGuard_Physics' End Object Mesh=UNCSkeletalMeshComponent Components.Add(UNCSkeletalMeshComponent) }
Last edited by dejocar; 02-10-2013 at 05:30 PM.
No problem, i am starting with UnrealScript as well so i know how frustrating can it be
Btw update on my issue - i managed to add premade UT weapon, the 'link gun'. I can see my character now running around in 3rd person nicely, but i can't see the weaponI can fire the weapon and see projectiles, but the weapon mesh is invisible -_- Since i am using the default wepon i guess that there is nothing wrong with that, probably something lacks in this camera code which is causing the weapon to not be displayed. The original camera code from this thread was written 2.5 years ago, probably something changed in the meantime in UDK and something must be specified to display 3rd person weapons. Could anybody help? Thanks
Im still having same problem.. the ONLY way i have gotten it to work is to follow the isometric from UDK but thats not why where here.. WE want the mouse zoom 3d rotate and the fuctions that ACTION has gvien us. SO With the MESH issue i just read
This SHOWS the MESH so why cant we just SHow the Weapon???Code:defaultproperties { CamHeight = 40.0 CamMinDistance = 40.0 CamMaxDistance = 350.0 CamOffsetDistance=250.0 CamZoomTick=20.0 Begin Object Class=SkeletalMeshComponent Name=UNCSkeletalMeshComponent SkeletalMesh=SkeletalMesh'CH_IronGuard_Male.Mesh.SK_CH_IronGuard_MaleA' AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human' AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale' PhysicsAsset=PhysicsAsset'CTF_Flag_IronGuard.Mesh.S_CTF_Flag_IronGuard_Physics' End Object Mesh=UNCSkeletalMeshComponent Components.Add(UNCSkeletalMeshComponent) }
SkeletalMesh=SkeletalMesh'WP_LinkGun.Mesh.SK_WP_Li nkGun_3P' is what i found for the mesh for basic link gun lets work from here
@Supamigit man you are lucky today. I solved this problem few days ago but today i remembered that i posted in this thread so i visited it now to post my solution. And lucky you that you posted today as wellthe solution - the class that determines how the weapon will look like in 3rd person is the weapon attachment class. I am using my custom weapon and i set everything there, but basically this is how it should go:
Code:class MyWeapon_Attachment extends UTBeamWeaponAttachment; defaultproperties { // this will set how the mesh will look like in 3rd person Begin Object Name=SkeletalMeshComponent0 SkeletalMesh=SkeletalMesh'WP_LinkGun.Mesh.SK_WP_LinkGun_3P' bOwnerNoSee=false bOverrideAttachmentOwnerVisibility=true bOnlyOwnerSee=false bIgnoreOwnerHidden=true End Object //MuzzleFlashSocket=MuzzleFlashSocket Mesh=SkeletalMeshComponent0 WeaponClass=class'MyWeapon_Gun' }Code:class MyWeapon_Gun extends UTWeapon; defaultproperties { AttachmentClass=class'MyWeapon_Attachment' //reference the attachment class // Pickup staticmesh Begin Object Name=PickupMesh SkeletalMesh=SkeletalMesh'WP_LinkGun.Mesh.SK_WP_LinkGun_3P' bOverrideAttachmentOwnerVisibility=true bOnlyOwnerSee=false bIgnoreOwnerHidden=true End Object }Of course there are multiple ways to do this. And you can also have other code in these classes, this just the minimum that i believe is required for weapon to appear in 3rd person! Let me know if it helped.Code:class MyGame extends UTGame; static event class<GameInfo> SetGameType(string MapName, string Options, string Portal) { return default.class; } function AddDefaultInventory( pawn PlayerPawn ) { if( PlayerPawn.IsHumanControlled() ) { PlayerPawn.CreateInventory(class'MyWeapon_Gun',true); //here we give our weapon to pawn } }
This camera is amazing, thank you for making it, and it works perfectly for me in the default UDK. However I am encountering this issue with it in the blank UDK:
http://imgur.com/HAPzX4F
Does anyone know a solution to add SetBehindView back into the blank UDK?
Its a requirement I work within the blank one and not the default one by my games course so just using the default version of UDK isnt an option sadly
Thanks to anyone who can help me with thisReally happy to finally have a working character in the blank UDK, just need to get the camera fixed ^_^
I just discovered this camera, and it's fantastic! I love how the camera and the player can move separately,
Its far superior to the attached cameras that I've found until now for a 3D platformer I'm working on.
However, I've run into a predicament. When I use this camera with custom meshes, It works fine 90% of the
time, but depending on the angle of the camera, the mesh blanks itself out and disappears.
Does anyone know of any fixes for this?
Bookmarks