>GetComponentByClass(UStaticMeshComponent::StaticClass())); map.Find(parentObj)->Add(itemstatic); } } else { if (attachActors.Num() == 0) { TArray<UPrimitiveComponent*> staticActors; auto itemstatic = Cast<UStaticMeshComponent>(actor->GetComponentByClass(UStaticMeshComponent::StaticClass(...
{if(OtherActor){//获得AttributeCompUSurAttributeComponent*AttributeComp=Cast<USurAttributeComponent>(OtherActor->GetComponentByClass(USurAttributeComponent::StaticClass()));// 再次判空,可能碰到的是墙壁、箱子等没有血量的物体if(AttributeComp){// 魔法粒子造成20血量伤害AttributeComp->ApplyHealthChange(-20.0...
通过查询UE4 C++的API,我找到了AActor::GetComponentByClass这个函数,官方文档的描述是: Searches components array and returns first encountered component of the specified class 即查找并获取本Actor的指定类型的组件的第一个。这不正是我需要的吗?如果我指定查找类型为USkeletalMeshComponent,而每个武器只有...
我们找到角色动画蓝图Gideon_AnimBlueprint 动画蓝图核心概念有图表Graphs和动画图表Animation Graphs。图表和蓝图类似,节点每帧调用,包含运行时角色运动的各种信息;动画图表决定了资产的姿势。 在动画蓝图中添加Blend Poses by bool: 接下来我们得看角色是否真的活着,我们不在动画蓝图判断,而是在别的地方直接赋值给IsAlive。
在蓝图函数库(同一个项目中任何蓝图都可以使用的函数)中添加一个自定义方法:GetComponentByName(根据名字来获得组件) 4、根据名字获得类(蓝图中使用工厂模式模拟实现,这是伪实现) 首先在蓝图函数库中添加一个辅助函数:GetClassName(获得类实例对象的显示名字。类实例对象:场景中已经生成的实例对象)...
UBoxComponent* BoxComponent = Cast<UBoxComponent>(AICoverPointsGenerator->GetComponentByClass(UBoxComponent::StaticClass())); //获取类相关属性 UProperty* bDrawDebug = AAICoverPointsGeneratorClass->FindPropertyByName(FName(TEXT("bDrawDebug"))); ...
TSoftObjectPtr TSoftClassPtr //蓝图调用函数 UFUNCTION(BlueprintCallable, Category = "XXX") //设置子Actor HandObject->SetChildActorClass(ASlAiHandObject::StaticClass()); //继承父类 Super::Xxx(); //获取组件 GetComponentByClass(UXXXComponent::StaticClass()); //调整Tick间隔为1秒 PrimaryActor...
UBoxComponent* BoxComponent = Cast<UBoxComponent>(AICoverPointsGenerator->GetComponentByClass(UBoxComponent::StaticClass())); //获取类相关属性 UProperty* bDrawDebug = AAICoverPointsGeneratorClass->FindPropertyByName(FName(TEXT("bDrawDebug"))); ...
1f; private float distance = 10; //终点距离起点范围 // Start is called before the first frame update private void Awake() { gc = FindObjectOfType<GameController>(); rb = GetComponent<Rigidbody>(); } void Start() { state = State.wait; } private void OnMouseDown() { if(state==...
if (ProjectileClass) { FActorSpawnParameters SpawnParams; SpawnParams.Owner = this; SpawnParams.Instigator = Instigator; FVector FireLocation = FireParticle->K2_GetComponentLocation(); AProjectileActor* Projectile = GetWorld()->SpawnActor<AProjectileActor>(ProjectileClass, FireLocation, FireRotator, Spa...