MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ apply_impulse()

void MayaFlux::Nodes::Network::PhysicsOperator::apply_impulse ( size_t  index,
const glm::vec3 &  impulse 
)

Apply impulse to specific particle.

Definition at line 773 of file PhysicsOperator.cpp.

774{
775 size_t offset = 0;
776 for (auto& group : m_collections) {
777 if (index < offset + group.collection->get_point_count()) {
778 size_t local_index = index - offset;
779 group.physics_state[local_index].velocity += impulse / group.physics_state[local_index].mass;
780 return;
781 }
782 offset += group.collection->get_point_count();
783 }
784}
uint32_t index
Definition VKDevice.cpp:142
float offset
size_t get_point_count() const override
Get source point count (before topology expansion)
std::vector< CollectionGroup > m_collections

References get_point_count(), index, m_collections, and offset.

+ Here is the call graph for this function: