Creating a physicalized entity
Now that we know how the physics system works, we can create our own physicalized entity that can collide with other physicalized geometry in our scene:
Note
This section assumes that you have read Chapter 3, Creating and Utilizing Custom Entities.
In C++
Based on what we learned earlier, we know that we can physicalize a static entity via the PE_STATIC
type:
SEntityPhysicalizeParams physicalizeParams; physicalizeParams.type = PE_STATIC; pEntity->Physicalize(physicalizeParams);
Assuming that geometry had been loaded for the entity prior to calling IEntity::Physicalize
, other physicalized objects will now be able to collide with our entity.
But what if we want to allow collisions to move our object in the world? That's where the PE_RIGID
type comes into play:
SEntityPhysicalizeParams physicalizeParams; physicalizeParams.type = PE_RIGID; physicalizeParams.mass = 10; pEntity->Physicalize(physicalizeParams);
Now, CryENGINE will know that our...