when I compile it I receive no errors but when trying to play in game the arms mesh and the gun mesh do not appear. you are able to run about crouch jump ect. you can even shoot things (APEX destructibles) but the gun does not appear. I have made sure its at the right scale everything is fine if you drag it into the scene. I have made sure all the default properties allow it to be visible, but quite honestly I have know idea what's messed up :/
if you could help that would be great
Code:
class OHFirearm extends Actor notplaceable abstract; // firearm skel mesh var SkeletalMeshComponent Mesh; // arms socket for firearm var SkeletalMeshSocket Socket; // attach firearm to arms simulated function AttachTo (OHWeapon Arms, OHPawn MSP) { local SkeletalMeshComponent SkelMesh; if((Arms.Mesh != None) && Arms.Mesh.bAttached) { SkelMesh = SkeletalMeshComponent(Arms.Mesh); if(SkelMesh != None) { SetOwner(Arms); SetHardAttach(True); SetBase(Arms, , SkelMesh, Arms.WeaponSocket); Socket = SkelMesh.GetSocketByName(Arms.WeaponSocket); SetRelativeLocation(Socket.RelativeLocation * SkelMesh.Scale); SetRelativeRotation(Socket.RelativeRotation); } } } // detach firearm simulated function DetachFrom() { SetOwner(None); SetHardAttach(False); SetBase(None); Socket = none; SetHidden(True); Destroy(); } //change visability simulated function ChangeVisibility(bool bIsVisible) { SetHidden(bIsVisible); If(Mesh != none) { Mesh.SetHidden(bIsVisible); } } defaultproperties { // anim sequence begin object class=AnimNodeSequence name=MeshSequenceA bCauseActorAnimEnd = true End Object // mesh begin object class=UDKSkeletalMeshComponent name=FirearmMesh TickGroup = TG_PreAsyncWork DepthPriorityGroup = SDPG_Foreground Animations = MeshSequenceA bOnlyOwnerSee = True bOverrideAttachmentOwnerVisibility = true bUpdateSkelWhenNotRendered = false bAllowAmbientOcclusion = false FOV = 65.0f CastShadow = false bCastDynamicShadow = false bAcceptsDynamicDecals = false bPerBoneMotionBlur = true end object Mesh = FirearmMesh Components.Add(FirearmMesh) TickGroup = TG_PreAsyncWork Physics = PHYS_None bStatic = false bCollideActors = false bBlockActors = false bWorldGeometry = false bCollideWorld = false bNoEncroachCheck = true bUpdateSimulatedPosition = false RemoteRole = ROLE_None bNoDelete = false }
Code:
class OHWeapon extends UDKWeapon dependson(OHPlayerController) config(Weapon) abstract; // --- animinations // arm idle anim var(animations) array<name> ArmIdleAnims; // arm equip anim var(animations) name ArmEquipAnim; // arm fire anim var(animations) name ArmFireAnim; // anim rates -------------- // arm idle anim rate var float ArmIdleAnimRate; // arm equip anim rate var float ArmEquipAnimRate; // arm fire anim rate var float ArmFireAnimRate; // arms mesh view offset var() vector ArmViewOffset; // --------------sockets // firearm socket var(Sockets) name WeaponSocket; // --------------firearm // fire arm class var(Firearm) class<OHFirearm> FirearmClass; // firearm var(Firearm) OHFirearm Firearm; // play weapon anim simulated function float PlayWeaponAnim(name AnimName, float Rate, optional bool bLooping, optional SkeletalMeshComponent SkelMesh, Optional float StartTime) { local AnimNodeSequence AnimNode; // get anim node sequence if(SkelMesh != none) { AnimNode = AnimNodeSequence(SkelMesh.Animations); } else { AnimNode = GetWeaponAnimNodeSeq(); } // no sequence so return if(AnimNode == none) return 0.01; //set anim if(AnimNode.AnimSeq == none || AnimNode.AnimSeq.SequenceName != AnimName) { AnimNode.SetAnim(AnimName); } // no anim so return if(AnimNode.AnimSeq == none) return 0.01; // play anim AnimNode.PlayAnim(bLooping, Rate, StartTime); // Return AnimLength return AnimNode.GetAnimPlaybackLength(); } //--play weapon animation by duration simulated function float PlayWeaponAnimByDuration(name AnimName, float Duration, optional bool bLooping, optional SkeletalMeshComponent SkelMesh, Optional float StartTime) { local float Rate; // use mesh if none passed in if ((SkelMesh == None) && Mesh != none) { SkelMesh = SkeletalMeshComponent(Mesh); } //if no mesh or anim return if(SkelMesh == none || AnimName == '' ) return 0.01; // get anim rate by duration Rate = SkelMesh.GetAnimRateByDuration(AnimName, Duration); // play anim by duartion PlayWeaponAnim(AnimName, Rate, bLooping, SkelMesh, StartTime); } // currently plaing anim simulated function bool IsPlayingAnim(name AnimName, optional bool bIsLooping, optional SkeletalMeshComponent SkelMesh) { local AnimNodeSequence AnimNode; // get anim node sequence if(SkelMesh !=none) { AnimNode = AnimNodeSequence(SkelMesh.Animations); } else { AnimNode = GetWeaponAnimNodeSeq(); } // no sequence so return if(AnimNode == none) return false; // not playing or anim name doesnt match or is looping but anim istnt if(!AnimNode.bPlaying || AnimNode.AnimSeq.SequenceName != AnimName || bIsLooping && !AnimNode.bLooping) { return false; } return true; } // curently playing any anim simulated function bool IsPlayingAnims(optional SkeletalMeshComponent SkelMesh, optional bool bLooping) { local AnimNodeSequence AnimNode; // get anim node sequence if(SkelMesh !=none) { AnimNode = AnimNodeSequence(SkelMesh.Animations); } else { AnimNode = GetWeaponAnimNodeSeq(); } // no sequence so return if(AnimNode == none) return false; // if looping force false if(bLooping && AnimNode.bLooping) return false; return AnimNode.bPlaying; } // get anim length simulated function float GetAnimLength(name AnimName, optional SkeletalMeshComponent SkelMesh) { local AnimNodeSequence AnimNode; // get anim node sequence if(SkelMesh !=none) { AnimNode = AnimNodeSequence(SkelMesh.Animations); } else { AnimNode = GetWeaponAnimNodeSeq(); } // no sequence so rturn if(AnimNode == none) return 0.01; AnimNode.SetAnim(AnimName); return AnimNode.GetAnimPlaybackLength(); } // get anim tine remaining simulated function float GetAnimTimeLeft(optional SkeletalMeshComponent SkelMesh) { local AnimNodeSequence AnimNode; // get anom node sequence if(SkelMesh != none) { AnimNode = AnimNodeSequence(SkelMesh.Animations); } else { AnimNode = GetWeaponAnimNodeSeq(); } // no sequence so return if(AnimNode == none) return 0.01; return AnimNode.GetTimeLeft(); } // overloaded align the arm mesh player view simulated event SetPosition(UDKPawn Holder) { local vector ViewOffset, DrawOffset; local rotator NewRotation; //if we are not in first person just return if(!Holder.IsFirstPerson()) return; // set view off set baised on arm view ofset ViewOffset = ArmViewOffset; // calculate location and rotation DrawOffset.Z = OHPawn(Holder).GetEyeHeight(); DrawOffset = DrawOffset + (ViewOffset >> Holder.Controller.Rotation); DrawOffset = Holder.Location + DrawOffSet; if(Holder.Controller == none) { NewRotation = Holder.GetBaseAimRotation(); } else { NewRotation = Holder.Controller.Rotation; } // set location/roation/base SetLocation(DrawOffset); SetRotation(NewRotation); SetBase(Holder); } // overloaded attach mesh simulated function AttachWeaponTo(SkeletalMeshComponent SkelMesh, optional name SocketName) { super.AttachWeaponTo(SkelMesh, SocketName); if((Mesh !=none) && !Mesh.bAttached) { AttachComponent(Mesh); AttachFirearm(); SetHidden(false); } } // actach firearm to arms simulated function AttachFirearm() { local OHPawn P; if(Instigator != none) { P = OHPawn(Instigator); if(FirearmClass != none) { Firearm = Spawn(FirearmClass); if(Firearm != none) { Firearm.AttachTo(Self, P); Firearm.ChangeVisibility(false); } } } } // overloaded detach arms simulated function DetachWeapon() { super.DetachWeapon(); if((Mesh != none) && Mesh.bAttached) { DetachFirearm(); DetachComponent(Mesh); } SetBase(none); SetHidden(true); } // detach firearm from arms simulated function DetachFirearm() { if(Firearm != none) { Firearm.DetachFrom(); } } // time weapon equiping simulated function TimeWeaponEquiping() { local float EquipAnimTime; //attach weapon if(Instigator != none) { // attach arm mesh AttachWeaponTo(instigator.Mesh); // play arm equip anim if(ArmEquipAnim != '') { // play anim and return anim length for equip timer EquipAnimTime = PlayweaponAnim(ArmEquipAnim, ArmEquipAnimRate, false); SetTimer(EquipAnimtime, false, 'WeaponEquipped'); } } } // state active simulated state Active { // begin state simulated function BeginState(Name PrevState) { // playing any anims if(IsPlayingAnims()) { // alrady playing an anim so get the time left and set timer SetTimer(GetAnimTimeLeft(), false, 'PlayIdleAnimation'); } else { PlayIdleAnimation(); } super.BeginState(PrevState); } // end state simulated function EndState(name NextState) { if(IsTimerActive('PlayIdleAnimation')) { ClearTimer('PlayIdleAnimation'); } super.EndState(NextState); } // play idle anim simulated function PlayIdleAnimation() { local int i; if(WorldInfo.NetMode != NM_DedicatedServer && ArmIdleAnims.Length > 0) { i = Rand(ArmIdleAnims.Length); PlayWeaponAnim(ArmIdleAnims[i], ArmIdleAnimRate, true); } } } // overloaded play fire efects simulated function PlayFireEffects(byte FireModenum, optional Vector HitLocation) { if(ArmFireAnim != '') { PlayWeaponAnim(ArmFireAnim ,ArmFireAnimRate, false); PlayWeaponAnim(ArmFireAnim ,ArmFireAnimRate, false, Firearm.Mesh); } } defaultProperties { //-----weqapon settings bInstantHit = true FiringStatesArray(0) = WeaponFiring WeaponFireTypes(0) = EWFT_InstantHit ShouldFireOnRelease(0) = 0 FireInterval(0) = 0.01 Spread(0) = 0.05 InstantHitDamage(0) = 10.0 InstantHitMomentum(0) = 1.0 InstantHitDamageTypes(0) = class'DamageType' //---------sockets WeaponSocket = WeaponSocket //--------Ammo AmmoCount = 99 // anim sequence begin object class=AnimNodeSequence name=MeshSequenceA bCauseActorAnimEnd = true end object // arms mesh begin object class=UDKSkeletalMeshComponent name=ArmsMeshComp SkeletalMesh = SkeletalMesh'Glock18.1p_Arms_SkMesh' AnimSets(0) = AnimSet'Glock18.b_Root' DepthPriorityGroup = SDPG_ForeGround bOnlyOwnerSee = true bOverrideAttachmentOwnerVisibility = true CastShadow = false FOV = 65.0f Animations = MeshSequenceA bPerBoneMotionBlur = true bAcceptsStaticDecals = false bAcceptsDynamicDecals = false bUpdateSkelWhenNotRendered = false bComponentUseFixedSkelBounds = true end object Mesh = ArmsMeshComp // mesh setting ArmViewOffset = (X=-48.0) // -------- animations ArmIdleAnims(0) = 1p_Idle ArmEquipAnim = 1p_Idle ArmFireAnim = 1p_Idle //------------anim rates ArmIdleAnimRate = 1.0 ArmEquipAnimRate = 1.0 ArmFireAnimRate = 1.0 }
Code:
class OHPawn extends UDKPawn config(Game) Placeable; // crouch eye height var float CrouchEyeHeight; // default inventory var array< class<Inventory> > DefaultInventory; // add default inventory function AddDefaultInventory() { local class<Inventory> InvClass; local Inventory Inv; foreach DefaultInventory(InvClass) { Inv = FindInventorytype(InvClass); if(Inv == none) { CreateInventory(InvClass, Weapon != none); } } } // overwritten calculate camera simulated function bool CalcCamera(float DeltaTime, out Vector out_CamLoc, out rotator out_CamRot, out float out_FOV) { GetActorEyesViewPoint(out_CamLoc, out_CamRot); return true; } // set movement physics function SetMovementPhysics() { if(PhysicsVolume.bWaterVolume) { SetPhysics(PHYS_Swimming); } else { if(Physics != PHYS_Falling) { SetPhysics(PHYS_Falling); } } } //overloaded; start crouch simulated event StartCrouch(float HeightAdjust) { SetBaseEyeHeight(); EyeHeight += HeightAdjust; CrouchMeshZOffset = HeightAdjust; if(Mesh != none) { Mesh.SetTranslation(Mesh.Translation + vect(0,0,1) * HeightAdjust); } } // overloaded end crouch simulated event EndCrouch(float HeightAdjust) { SetBaseEyeHeight(); EyeHeight -= HeightAdjust; CrouchMeshZOffset = 0.0; if(Mesh != none) { Mesh.SetTranslation(Mesh.Translation + vect(0,0,1) * HeightAdjust); } } // overload: force crouch height simulated function SetBaseEyeHeight() { if(!bIsCrouched) { BaseEyeHeight = default.BaseEyeHeight; } else { BaseEyeHeight = CrouchEyeHeight; } } // overloaded: interpolate eye height event UpdateEyeHeight(float DeltaTime) { if(bTearOff) { EyeHeight = default.BaseEyeHeight; bUpdateEyeHeight = false; return; } EyeHeight = FInterpTo(EyeHeight, BaseEyeHeight, DeltaTime, 10.0); } // overloaded get pawn view location simulated event vector GetPawnViewLocation() { if(bUpdateEyeHeight) { return Location + EyeHeight * vect(0,0,1); } else { return Location + BaseEyeHeight * vect(0,0,1); } } // overloaded become view target and begin eye height interp simulated event BecomeViewTarget(PlayerController PC) { super.BecomeViewTarget(PC); if(LocalPlayer(PC.Player) != none) { bUpdateEyeHeight = true; } } // current Eye Height simulated function float GetEyeHeight() { if(!IsLocallyControlled()) { return BaseEyeHeight; } else { return EyeHeight; } } defaultproperties { InventoryManagerClass = class'OHGame.OHInventoryManager' ControllerClass = none // mesh begin object class=SkeletalMeshComponent name=SkelMesh BlockZeroExtent = true CollideActors = true BlockRigidBody = true RBChannel = RBCC_Pawn RBCollideWithChannels = (Default=true,Pawn=true,DeadPawn=false,BlockingVolume=true,EffectPhysics=true,FracturedMeshPart=true,SoftBody=true) MinDistFactorForKinematicUpdate = 0.2 bAcceptsStaticDecals = false bAcceptsDynamicDecals = false bUpdateSkelWhenNotRendered = true bIgnoreControllersWhenNotRendered = false bTickAnimNodesWhenNotRendered = true bUseOnePassLightingOnTranslucency = true bPerBoneMotionBlur = true bHasPhysicsAssetInstance = true bOwnerNoSee = true end object Mesh = SkelMesh Components.Add(SkelMesh) // colision cylinder begin object name=CollisionCylinder CollisionHeight = +0044.000000 CollisionRadius = +0021.000000 BlockZeroExtent = false end object CylinderComponent = CollisionCylinder // Pawn setting CrouchHeight = +0029.000000 CrouchRadius = +0034.000000 EyeHeight = +0038.000000 CrouchEyeHeight = +0023.000000 BaseEyeHeight = +0038.000000 //movement GroundSpeed = 440.0 WalkingPct = 0.4 CrouchedPct = 0.4 JumpZ = 332.0 AccelRate = 2048.0 //settings bBlocksNavigation = true bNoEncroachCheck = true bCanStepUpOn = false bCanStrafe = true bCanCrouch = true bCanClimbLadders = true bCanPickUpInventory = true bCanWalkOffLedges = true bCanSwim = true // camera ViewPitchMin = -16000 ViewPitchMax = 14000 // default inventory DefaultInventory(0) = class'OHGame.OHWeapon_Pistol' }
