Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This example shows how you can use a simulation event to interact with Physx rigid bodies.

import Atoms
import AtomsCore
import AtomsMath
import AtomsMaya
import os

class PhysxSimEvent(Atoms.SimulationEvent):
    eventName = 'PhysxSimEvent'

    def __init__(self):
        Atoms.SimulationEvent.__init__(self)
        self.setName(self.eventName)

    def load(self):
        pass

    def unload(self):
        pass

    def initSimulation(self):
        pass

    def initFrame(self):
        pass

    def computeFrame(self):
        physx = AtomsMaya.getPhysics("tcAtomsSolver")
        for id in physx.rigidBodyIds():
            print id
            rb = physx.rigidBody(id)
            rb.addImpulse(AtomsMath.V3f(0,10,0))

    def endFrame(self):
        pass

    def endSimulation(self):
        pass

    def resetSimulation(self):
        pass


  • No labels