実装メモ:ParticleEmitterComponent でパーティクルを Entity 自身に吸収させる

パーティクル演出は基本的に放出されるようなイメージがあるが、visionOS の ParticleEmitterComponent では内向きに集約させることもできるのでメモ。

mainEmitter.attractionCenter に吸収先の座標を指定すればよく、emitterShapeSize を Entity のサイズよりも大きく指定した上で、エミッターを持つ Entity 中心座標を指定すれば、自分自身にパーティクルを吸収させることができる。

var p = entity.components[ParticleEmitterComponent.self]!
p.emitterShape = .sphere
p.emitterShapeSize = .init(x: 0.1, y: 0.1, z: 0.1)
p.fieldSimulationSpace = .local
p.mainEmitter.attractionCenter = entity.position(relativeTo: entity)

entity.components[ParticleEmitterComponent.self] = p

検証環境:visionOS 26.0.1

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny