Update DismemberedAnimInstance.cpp
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
UDismemberedAnimInstance::UDismemberedAnimInstance()
|
||||
{
|
||||
// 初始化成员变量
|
||||
//Initialize member variables
|
||||
SourceBoneName = NAME_None;
|
||||
CutType = 0;
|
||||
RootBoneName = NAME_None;
|
||||
@@ -19,10 +19,10 @@ void UDismemberedAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
|
||||
{
|
||||
Super::NativeUpdateAnimation(DeltaSeconds);
|
||||
|
||||
// 更新动画逻辑
|
||||
// 可以根据LinearVelocity和AngularVelocity更新动画状态
|
||||
|
||||
// 随时间衰减速度
|
||||
//Update animation logic
|
||||
// You can update the animation state based on LinearVelocity and AngularVelocity
|
||||
|
||||
// Decay speed over time
|
||||
const float DampingFactor = 0.95f;
|
||||
LinearVelocity *= DampingFactor;
|
||||
AngularVelocity *= DampingFactor;
|
||||
@@ -32,14 +32,14 @@ void UDismemberedAnimInstance::NativeInitializeAnimation()
|
||||
{
|
||||
Super::NativeInitializeAnimation();
|
||||
|
||||
// 获取拥有者骨骼网格体
|
||||
// Get the owner skeleton mesh
|
||||
USkeletalMeshComponent* OwnerMesh = GetSkelMeshComponent();
|
||||
if (!OwnerMesh)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 初始化动画相关参数
|
||||
// Initialize animation related parameters
|
||||
}
|
||||
|
||||
void UDismemberedAnimInstance::SetSourceBone(const FName& BoneName)
|
||||
@@ -54,10 +54,10 @@ void UDismemberedAnimInstance::SetCutType(int32 InCutType)
|
||||
|
||||
void UDismemberedAnimInstance::ApplyImpulse(const FVector& Impulse)
|
||||
{
|
||||
// 应用冲量到分离的部分
|
||||
// Apply impulse to the separated part
|
||||
LinearVelocity += Impulse;
|
||||
|
||||
// 根据冲量生成一些随机的角速度
|
||||
// Generate some random angular velocity based on the impulse
|
||||
const float AngularImpulseFactor = 0.1f;
|
||||
FVector RandomAngular = FVector(
|
||||
FMath::RandRange(-1.0f, 1.0f),
|
||||
@@ -66,4 +66,4 @@ void UDismemberedAnimInstance::ApplyImpulse(const FVector& Impulse)
|
||||
);
|
||||
|
||||
AngularVelocity += RandomAngular * Impulse.Size() * AngularImpulseFactor;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user