Unreales / UDK Español

SkelControlFootPlacement

« Older   Newer »
  Share  
Coywen
icon14  view post Posted on 27/2/2014, 18:56




Buenos dias a tod@-s vengo a consultar aver si alguien me puede ayudar hacer mi codigo de

SkelControlFootPlacement

ya que al ir a udn no he podido hacerlo y quiero que se vea bien mi personaje.

Muchas Gracias por leer el tema ^_^
 
Top
acadis
view post Posted on 27/2/2014, 19:55




No hay mucha info de lo que tienes echo o no,asi es dificil saber por donde empezar con la ayuda.
 
Top
Coywen
view post Posted on 27/2/2014, 20:00




Pues ahora mismo tengo el animtree creado con el RightFootPlacementSkelControl y solo me falta el codigo y como meter ese control.
 
Top
acadis
view post Posted on 27/2/2014, 20:25




Si heredas de UDKPawn,las variable son estas.

/*********************************************************************************************
* Foot placement IK system
********************************************************************************************* */
var name LeftFootBone, RightFootBone;
var name LeftFootControlName, RightFootControlName;
var float BaseTranslationOffset;
var float CrouchTranslationOffset;
var float OldLocationZ;
var bool bEnableFootPlacement;
var const float ZSmoothingRate;

/** if the pawn is farther than this away from the viewer, foot placement is skipped */
var float MaxFootPlacementDistSquared;

/** cached references to skeletal controllers for foot placement */
var SkelControlFootPlacement LeftLegControl, RightLegControl;
 
Top
Coywen
view post Posted on 27/2/2014, 20:46




Eso va en el pawn y en el default poner el nombre de dicho socket ?
 
Top
Coywen
view post Posted on 4/3/2014, 13:17




Explico breve mente lo que me ha pasado, resulta que mi personaje inicial en vez de pisar bien y subir las montañas correctamente las sube en linea recta, entonces buscando en los foros de epic encontre un tipo de variable que es el Foot placement. Me vendría bien una breve explicasion de lo que deveria hacer para colocar dicha variable.
 
Top
acadis
view post Posted on 4/3/2014, 14:09




Puedes poner una imagen? tambien puedes decirme si en el animtree tienes los 2 footplacement,si tienes bEnableFootPlacement=true en el defaultproperties de tu pawn.Depues en default properties (si heredas a udk Pawn).

LeftFootControlName=LeftFootControl
RightFootControlName=RightFootControl
bEnableFootPlacement=true
MaxFootPlacementDistSquared=56250000.0 // 7500 squared


en la simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)

simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
if (SkelComp == Mesh)
{
LeftLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(LeftFootControlName));
RightLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(RightFootControlName));
}


super.PostInitAnimTree(SkelComp);
}
 
Top
Coywen
view post Posted on 4/3/2014, 15:16




Mi clase extiende a UDKPawn

El Error que me da:

6682ba25b952179cad6f925aff6c1bfco

Mi AnimTree:

2d5fb8b72249f5d4cbe1692e835f9b18o

Mi Pawn:

class RPGPawn extends UDKPawn;

/*********************************************************************************************
* Foot placement IK system
********************************************************************************************* */
var name LeftFootBone, RightFootBone;
var name LeftFootControlName, RightFootControlName;
var float BaseTranslationOffset;
var float CrouchTranslationOffset;
var float OldLocationZ;
var bool bEnableFootPlacement;
var const float ZSmoothingRate;

/** if the pawn is farther than this away from the viewer, foot placement is skipped */
var float MaxFootPlacementDistSquared;

/** cached references to skeletal controllers for foot placement */
var SkelControlFootPlacement LeftLegControl, RightLegControl;

/******************************************************************************
Propiedades del Apuntado
******************************************************************************/
var AnimNodeAimOffset RPGAimNode; // Referencia al nodo de animación de AimOffset
var Rotator DesiredAim; // Aim deseado
var Rotator CurrentAim; // Aim actual
var float AimSpeed; // Velocidad de apuntado

/******************************************************************************
Propiedades del SkeletalMesh
******************************************************************************/
var const SkeletalMeshComponent ArmsSkeletalMesh;
var const SkeletalMeshComponent BootsSkeletalMesh;

/* Iluminación de entorno */
var DynamicLightEnvironmentComponent LightEnvironment;

/******************************************************************************
Propiedades de Cámara
******************************************************************************/
var vector DesiredCamStartLocation; // Posición deseada desde la que se hace el offset (Posición del Pawn)
var vector DesiredCamOffset; // Offset deseado de la cámara
var float DesiredCamScale; // CameraScale deseado
var float DesiredCamZOffset; // Offset en z de la cámara (añadido al offset de cámara)

var vector CurrentCamStartLocation; // Posición actual desde la que se hace el offset
var vector CurrentCamOffset; // Offset actual interpolado de la cámara
var float CurrentCamScale; // Se usa para interpolar entre distintos CameraScales
var float CurrentCamZOffset; // Usado para interpolar el offset en z de la cámara

var vector CamOffsetDefault; // Offset de postura Default
var vector CamOffsetAimRight; // Offset de postura AimRight

var float CameraInterpolationSpeed; //Velocidad de interpolación


// Posturas para disparo y aiming:
enum PawnWeaponType
{
PWT_Default,
PWT_AimRight
};

var PawnWeaponType WeaponType; // Postura actual

// Cambia el tipo de Weapon, cambiando así la postura
function SetWeaponType(PawnWeaponType NewWeaponType)
{
WeaponType = NewWeaponType;
}

// Cambia al arma por defecto
function SetDefaultWeaponType()
{
SetWeaponType(PWT_Default);
}


// Sobreescribe una función para que se vea al pawn por defecto
// La llama la Camara cuando este actor se convierte en su ViewTarget
simulated event BecomeViewTarget( PlayerController PC )
{
local UTPlayerController UTPC;

// Por defecto esta llamada pone los brazos al Pawn y el arma inicial (y otras cosas)
Super.BecomeViewTarget(PC);

if (LocalPlayer(PC.Player) != None)
{
UTPC = UTPlayerController(PC);
if (UTPC != None)
{
// Activa la vista trasera (Poner la camara en tercera persona y hace desaparecer brazos y armas de primera persona
UTPC.SetBehindView(true);
// Esto no es necesario
//SetMeshVisibility(UTPC.bBehindView);
}
}
}

// Función que calcula la posición de la cámara
// Es un ripoff de la función CalcThirdPersonCam de UTPawn, quitando los casos de DebugCam o cuado se gana la partida
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc,
out rotator out_CamRot, out float out_FOV )
{
local vector HitLocation, HitNormal, CamDirX, CamDirY, CamDirZ;

// Valores deseados:
DesiredCamStartLocation = Location; // El punto inicial de la cámara es la posición del Pawn
if(WeaponType == PWT_AimRight) // Offset varía según postura (tipo de arma)
{
DesiredCamOffset = CamOffsetAimRight;
}
else
{
DesiredCamOffset = CamOffsetDefault;
}
DesiredCamZOffset = (Health > 0) ? 1.0 * GetCollisionHeight() + Mesh.Translation.Z : 0.f;

// Valores interpolados:
CurrentCamStartLocation = VLerp(CurrentCamStartLocation, DesiredCamStartLocation, CameraInterpolationSpeed*fDeltaTime);
CurrentCamOffset = VLerp(CurrentCamOffset, DesiredCamOffset, CameraInterpolationSpeed*fDeltaTime);
CurrentCamScale = Lerp(CurrentCamScale, DesiredCamScale, CameraInterpolationSpeed*fDeltaTime);
CurrentCamZOffset = Lerp(CurrentCamZOffset, DesiredCamZOffset, CameraInterpolationSpeed*fDeltaTime);

if ( Health <= 0 )
{
CurrentCamOffset = vect(0,0,0);
CurrentCamOffset.X = GetCollisionRadius();
}

// Se extraen los ejes de la rotación de la cámara
GetAxes(out_CamRot, CamDirX, CamDirY, CamDirZ);
// Escala de la camara (zoom)
CamDirX *= CurrentCamScale;

if ( (Health <= 0) || bFeigningDeath )
{
// adjust camera position to make sure it's not clipping into world
// @todo fixmesteve. Note that you can still get clipping if FindSpot fails (happens rarely)
FindSpot(GetCollisionExtent(),CurrentCamStartLocation);
}

// Cálculo de la posición final de la cámara
out_CamLoc = (CurrentCamStartLocation + vect(0.0,0.0,1.0) * CurrentCamZOffset) - CamDirX*CurrentCamOffset.X + CurrentCamOffset.Y*CamDirY + CurrentCamOffset.Z*CamDirZ;

// Se traza un rayo para calcular posibles colisiones con la geometría
if (Trace(HitLocation, HitNormal, out_CamLoc, CurrentCamStartLocation, false, vect(12,12,12)) != None)
{
out_CamLoc = HitLocation;
}

return true;
}

/******************************************************************************
Propiedades del Apuntado
******************************************************************************/
simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
// Se busca la referencia del nodo de Aiming
RPGAimNode = AnimNodeAimOffset(SkelComp.FindAnimNode('RPGAimNode'));
}

simulated event Destroyed()
{
Super.Destroyed();
RPGAimNode = None; //Es necesario desreferenciar el nodo para que el Pawn se destruya correctamente
}

simulated function Tick(float DeltaTime)
{
Super.Tick(DeltaTime);

// Se obtiene la rotación actual del controller y se clampea con el max y min
DesiredAim = GetBaseAimRotation();
DesiredAim.Pitch = Clamp(DesiredAim.Pitch, ViewPitchMin, ViewPitchMax);

// Interpolación de la rotación
if (DesiredAim != CurrentAim)
{
CurrentAim = RLerp(CurrentAim, DesiredAim, AimSpeed * DeltaTime, false);
}

// Se cambia el nodo de animación
if (CurrentAim.Pitch < 0)
{
RPGAimNode.Aim.Y = -float(CurrentAim.Pitch) / ViewPitchMin;
}
else if (CurrentAim.Pitch > 0)
{
RPGAimNode.Aim.Y = float(CurrentAim.Pitch) / ViewPitchMax;
}
else
{
RPGAimNode.Aim.Y = 0.f;
}
}

// Sobreescribe la funcion de Pawn
function AddDefaultInventory()
{
// Se le da al Pawn el arma al comenzar
InvManager.CreateInventory(class'MyRPG.RPGWeapon1',true); // No activar por defecto
InvManager.CreateInventory(class'MyRPG.RPGWeapon2',true);
}

// Cambio de arma, llamado desde RPGPlayerController
simulated function SwitchWeapon(byte NewGroup)
{
if (RPGInventoryManager(InvManager) != None)
{
// Se le indica al Manager del Inventario que cambie de arma
RPGInventoryManager(InvManager).SwitchWeapon(NewGroup);
}
}

simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
if (SkelComp == Mesh)
{
LeftLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(LeftFootControlName));
RightLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(RightFootControlName));
}


super.PostInitAnimTree(SkelComp);
}


defaultproperties
{
// Iluminación de entorno del Pawn
// Iluminacion de entorno del Pawn
Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
bSynthesizeSHLight=false
bIsCharacterLightEnvironment=false
bUseBooleanEnvironmentShadowing=FALSE
InvisibleUpdateTime=1
MinTimeBetweenFullUpdates=.2
End Object
Components.Add(MyLightEnvironment)
LightEnvironment=MyLightEnvironment

// Componente SkeletalMesh para el robot
Begin Object Class=SkeletalMeshComponent Name=TORSO
SkeletalMesh=SkeletalMesh'Dario.Human.Human_M_H00_Body_Skel'
LightEnvironment=MyLightEnvironment
AnimSets(0)=AnimSet'Dario.Human.Human_M_H00_Body_Skel_Anims'
AnimTreeTemplate=AnimTree'Dario.Human.Human_M_H00_Body_Skel_Tree'
PhysicsAsset=PhysicsAsset'Dario.Human.Human_M_H00_Body_Skel_Physics'
End Object
Mesh=TORSO
Components.Add(TORSO)


Begin Object Class=SkeletalMeshComponent Name=Boots
LightEnvironment=MyLightEnvironment
SkeletalMesh=SkeletalMesh'Dario.Human.Human_M_H00_Leg_Skel'
ParentAnimComponent=TORSO
ShadowParent=TORSO
End Object
BootsSkeletalMesh=Boots
Components.Add(Boots)


Begin Object Class=SkeletalMeshComponent Name=Arms
LightEnvironment=MyLightEnvironment
SkeletalMesh=SkeletalMesh'Dario.Human.Human_M_H00_Hand_Skel'
ParentAnimComponent=TORSO
ShadowParent=TORSO
End Object
ArmsSkeletalMesh=Arms
Components.Add(Arms

// Se hace más pequeño el cilindro de colisión
Begin Object Name=CollisionCylinder
CollisionRadius=+0010.000000
CollisionHeight=+26.600000
End Object
CylinderComponent=CollisionCylinder

//El robot es un poco grande
DrawScale=0.8
//Velocidad de Animacion dentro del mapa
GroundSpeed=105
//Velocidad al Apuntar
AimSpeed=8

LeftFootControlName=LeftFootControl
RightFootControlName=RightFootControl
bEnableFootPlacement=true
MaxFootPlacementDistSquared=56250000.0 // 7500 squared


// Propiedades de cámara
DesiredCamScale=20.0
CurrentCamScale=0.0

CameraInterpolationSpeed=8.0 //Velocidad de interpolación de la cámara

CamOffsetDefault=(X=4.0,Y=0.0,Z=-13.0) // Offset postura default
CamOffsetAimRight=(X=4.0,Y=40.0,Z=-13.0) // Offset postura RightAim


//Locomoción
JumpZ=+0600.000000
MaxFallSpeed=+1200.0 //Máxima velocidad al caer sin hacerse daño
AirControl=+0.1 //Control aéreo
CustomGravityScaling=1.3 //Multiplicador de gravedad personal

InventoryManagerClass=class'MyRPG.RPGInventoryManager'
}
 
Top
acadis
view post Posted on 4/3/2014, 15:38




Bien,los warning son porque la variable son repetidas(ya estan en el udk pawn) quitalas.El error es que repites 2 veces la misma function simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp).


simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
if (SkelComp == Mesh)
{
LeftLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(LeftFootControlName));
RightLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(RightFootControlName));
}


super.PostInitAnimTree(SkelComp);
}



simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
// Se busca la referencia del nodo de Aiming
RPGAimNode = AnimNodeAimOffset(SkelComp.FindAnimNode('RPGAimNode'));
}





Mejor asi:

simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
{
if (SkelComp == Mesh)
{
// Se busca la referencia del nodo de Aiming
RPGAimNode = AnimNodeAimOffset(SkelComp.FindAnimNode('RPGAimNode'));

LeftLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(LeftFootControlName));
RightLegControl = SkelControlFootPlacement(Mesh.FindSkelControl(RightFootControlName));
}

}


Espero que asi te funcione.

PD: Mucho mejor la info.
 
Top
Coywen
view post Posted on 4/3/2014, 15:56




Muchísimas gracias, me podrías dar una breve explicación de como lo supiste reparar ?, es mas que nada para ir entendiendo y identificando dichos errores para repararlo sin tener que estar consultando al foro. Para en vez de ser ayudado poder ayudar =)
 
Top
acadis
view post Posted on 4/3/2014, 16:07




la consola de udk te dice que errores y que linea,otras veces hay que saber interpretarlos.
 
Top
Coywen
view post Posted on 4/3/2014, 16:40




Muchísimas Gracias Acadis, ahora estoy poniendo bien el Foot del animtree ya que se me va los pies para todos lados jajaja, Gracias y espero que esto le sirva de ayuda a los otros miembros del foro
 
Top
11 replies since 27/2/2014, 18:56   93 views
  Share