일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- CTF
- gameplay effect
- listen server
- UI
- attribute
- gameplay ability system
- Aegis
- MAC
- stride
- 언리얼 엔진
- 유니티
- network object pooling
- os
- map design
- Unreal Engine
- 보안
- gas
- photon fusion2
- Multiplay
- 게임 개발
- unity
- local prediction
- Replication
- nanite
- animation
- gameplay tag
- 언리얼엔진
- rpc
- 게임개발
- ability task
Archives
- Today
- Total
Replicated
[ChronoSpace] Gravity 반전 스위치 본문
World의 중력을 바꾸려 했는데 기본적으로 월드 중력은 Z 방향으로밖에 설정 안됨
아니면 CharacterMovement에서 SetGravityDirection 해야 함
일단 나중에 다른 방향으로 중력을 바꿀 수 있도록 SetGravityDirection 기반으로 구현 (벽 달리기?)
스위치는 여러 개 있을 수 있음
맵 전체 크기에 싱글톤 트리거나 트레이스를 써야 하나 했는데, 굳이 그럴 필요가 없지 않을까?
어차피 월드의 모든 캐릭터를 대상으로 SetGravityDirection을 할 건데
그러면 그냥 TActorIterator로 캐릭터 다 들고 와서 중력 바꾸면 되는 거 아닌가?
-> TActorIterator로 그냥 Character 서브 클래스 다 들고 오는게 차라리 나음
그리고 모든 스위치는 활성화 상태가 동기화되어야 함
(다른 스위치가 활성화되면 월드의 다른 모든 스위치도 활성화되는 식)
void ACSGravitySwitch::Interact()
{
Super::Interact();
for (TActorIterator<ACharacter> It(GetWorld()); It; ++It)
{
ACharacter* Char = *It;
FVector CharGravity = Char->GetCharacterMovement()->GetGravityDirection();
if ( bIsInteracted )
{
CharGravity.Z = FMath::Abs(CharGravity.Z);
UCSCustomGravityDirComponent::OrgGravityDirection = FVector(0.0f, 0.0f, 1.0f);
}
else
{
CharGravity.Z = -1.0f * FMath::Abs(CharGravity.Z);
UCSCustomGravityDirComponent::OrgGravityDirection = FVector(0.0f, 0.0f, -1.0f);
}
Char->GetCharacterMovement()->SetGravityDirection(CharGravity);
}
for (TActorIterator<ACSGravitySwitch> It(GetWorld()); It; ++It)
{
ACSGravitySwitch* Switch = *It;
Switch->SetInteracted(bIsInteracted);
}
}
void ACSGravitySwitch::SetInteracted(bool bInInteracted)
{
bIsInteracted = bInInteracted;
SetMaterial();
}
앞에서 했던 내용들의 단순 응용일 뿐이라 별로 어려울 것은 없다
'언리얼 엔진 > ChronoSpace' 카테고리의 다른 글
[ChronoSpace] 대미지 장판 (0) | 2025.03.04 |
---|---|
[ChronoSpace] ** Vector 내적을 이용한 중력 벡터 투영(Projection), 평면화(Flatten) ** (0) | 2025.02.22 |
[ChronoSpace] Switch (0) | 2025.02.20 |
[ChronoSpace] Interaction 구현 (0) | 2025.02.19 |
[ChronoSpace] Patrol 배치, Clockwork Labyrinth 프로토타입 완성 (0) | 2025.02.17 |