• PhantomPhysicsComponent (Components\PhysicsComponents\PhantomPhysicsComponent.cs) 
    • Entities with Phantom physics will not respond to things like gravity or collision in ways that will move them. However, phantoms are great for things like collision triggers (which we’ll talk more in detail about later). The gist of a collision triggers is that you can know when something has entered and left a collision trigger, and can do specific actions based on those events.
    • If you look in SampleScene.cs, in the BoxAntiGrav() function you will find this line of code:
      PhantomPhysicsComponent newPhysComponent = new PhantomPhysicsComponent(newEntity, ShapeType.Box, 10.0);

      This code is very similar to creating a regular PhysicsComponent, but you’ll notice this one is spelled PhantomPhysicsComponent. Other than that, they’ll created the same way as a regular physics component. You’ll see more stuff after that line, that is where we’re creating the collision trigger, which we’ll go over later.
    • If you're creating an entity through a definition XML, just specify that it uses PhantomPhysicsComponent rather thanPhysicsComponent, but in the entity definition you can reference a standard PhysicsComponent definition XML file and it will treat it as a phantom. That is why you'll notice in the 'ComponentDefinitions' folder  there is a 'Physics' folder but no 'PhantomPhysics' folder.

Last edited Jan 5, 2012 at 4:37 AM by LordIkon, version 1

Comments

No comments yet.