IEntityRopeComponent

IEntityRopeComponentabstract

#include

Inherits IEntityComponent.

Public Member Functions

virtual struct IRopeRenderNode * GetRopeRenderNode ()=0
- Public Member Functions inherited from IEntityComponent
virtual ICryFactory * GetFactory () const
ILINE IEntity * GetEntity () const
ILINE EntityId GetEntityId () const
IEntityComponent (IEntityComponent &&other)
IEntityComponent (const IEntityComponent &)=default
IEntityComponent & operator= (const IEntityComponent &)=default
IEntityComponent & operator= (IEntityComponent &&)=default
const CEntityComponentClassDesc & GetClassDesc () const
virtual uint64 GetEventMask () const
virtual ComponentEventPriority GetEventPriority () const
Determines the order in which this component will receive entity events (including update). Lower number indicates a higher priority.
virtual NetworkAspectType GetNetSerializeAspectMask () const
Network serialization. Override to provide a mask of active network aspects used by this component. Called once during binding to network. More...
virtual bool NetSerialize (TSerialize ser, EEntityAspects aspect, uint8 profile, int flags)
Network serialization. Will be called for each active aspect for both reading and writing. More...
virtual void NetReplicateSerialize (TSerialize ser)
virtual void NetMarkAspectsDirty (const NetworkAspectType aspects)
Call this to trigger aspect synchronization over the network. A shortcut. More...
virtual IEntityComponentPreviewer * GetPreviewer ()
Override this to return preview render interface for the component. Multiple component instances can usually share the same previewer class instance. More...
void SetComponentFlags (ComponentFlags flags)
END IEntityComponent virtual interface. More...
const ComponentFlags & GetComponentFlags () const
Return flags for this component.
ComponentFlags & GetComponentFlags ()
const CryGUID & GetGUID () const
IEntityComponent * GetParent () const
const CryTransform::CTransformPtr & GetTransform () const
Return Transformation of the entity component relative to the owning entity or parent component.
void SetTransformMatrix (const Matrix34 &transform)
Sets the transformation form a matrix. If the component doesn't have a transformation yet the function will add one.
void SetTransformMatrix (const CryTransform::CTransformPtr &transform)
Sets the transformation from another transformation. If the component doesn't have a transformation yet the function will add one.
Matrix34 GetWorldTransformMatrix () const
Return Transformation of the entity component relative to the world.
Matrix34 GetTransformMatrix () const
Return Calculated Transformation Matrix for current component transform.
const char * GetName () const
Get name of this individual component, usually only Schematyc components will have names.
void SetName (const char *szName)
int GetEntitySlotId () const
Return optional EntitySlot id used by this Component.
int GetOrMakeEntitySlotId ()
void SetEntitySlotId (int slotId)
Stores Entity slot id used by this component.
void FreeEntitySlot ()
Frees entity slot used by this component.
EEntitySimulationMode GetEntitySimulationMode () const
Return Current simulation mode of the host Entity.
void SendEvent (const SEntityEvent &event)
virtual void GetMemoryUsage (ICrySizer *pSizer) const
virtual void GameSerialize (TSerialize ser)
virtual bool NeedGameSerialize ()
virtual void LegacySerializeXML (XmlNodeRef &entityNode, XmlNodeRef &componentNode, bool bLoading)
virtual struct IEntityPropertyGroup * GetPropertyGroup ()
Only for backward compatibility to Release 5.3.0 for loading.
virtual EEntityProxy GetProxyType () const
Legacy, used for old entity proxies.

Additional Inherited Members

- Public Types inherited from IEntityComponent
typedef int ComponentEventPriority
typedef EEntityComponentFlags EFlags
typedef EntityComponentFlags ComponentFlags
- Static Public Attributes inherited from IEntityComponent
static constexpr int EmptySlotId = -1
- Protected Member Functions inherited from IEntityComponent
virtual void * QueryInterface (const CryInterfaceID &iid) const
virtual void * QueryComposite (const char *name) const
virtual void PreInit (const SInitParams &params)
virtual void Initialize ()
Called at the very first initialization of the component, at component creation time.
virtual void OnShutDown ()
Called on all Entity components right before all of the Entity Components are destructed.
virtual void OnTransformChanged ()
Called when the transformation of the component is changed.
virtual void ProcessEvent (const SEntityEvent &event)
- Protected Attributes inherited from IEntityComponent
friend IEntity
IEntity * m_pEntity = nullptr
ComponentFlags m_componentFlags
CryGUID m_guid
Unique GUID of the instance of this component.
string m_name
name of this component
CryTransform::CTransformPtr m_pTransform
Optional transformation setting for the component within the Entity object.
IEntityComponent * m_pParent = nullptr
Optional pointer to our parent component.
const CEntityComponentClassDesc * m_pClassDesc = nullptr
int m_entitySlotId = EmptySlotId
Optional Entity SlotId for storing component data like geometry of character.

Detailed Description

Interface to the rope component, providing support for creating a rendered and physical rope on the entity position

#include 
#include 
#include 

void CreateRopeComponent(IEntity& entity)
{
    // Create a new rope component for the entity, automatically creates a rope render node
    IEntityRopeComponent* pRopeComponent = entity.CreateComponent();
    IRopeRenderNode* pRenderNode = pRopeComponent->GetRopeRenderNode();

    // Set the desired rope behavior
    IRopeRenderNode::SRopeParams ropeParams;

    // Create a smoothened rope that responds to collisions from other entities
    ropeParams.nFlags = IRopeRenderNode::eRope_CheckCollisinos | IRopeRenderNode::eRope_Smooth;
    // Specify the thickness of the rope
    ropeParams.fThickness = 0.05f;
    // Determine the number of segments to use on the rope
    ropeParams.nNumSegments = 12;
    // Number of sides / faces to use on the rope
    ropeParams.nNumSides = 4;

    // Number of segments to use for the physical representation of the rope
    ropeParams.nPhysSegments = 12;
    // Total mass of the rope, a value of 0 would result in a static / immovable rope
    ropeParams.mass = 5.0f;

    pRenderNode->SetParams(ropeParams);

    // Now specify the world  space coordinates of the points of our rope
    // For the sake of this example we use two points, but more can be used.
    std::array ropePoints;
    // Start the rope at the entity world position
    ropePoints[0] = entity.GetWorldPos();
    // Give the length of one meter / unit, along the forward direction of the entity
    ropePoints[1] = entity.GetWorldPos() + entity.GetWorldRotation() * Vec3(0, 1, 0);
    // Now set the points on the rope, thus creating the render and physical representation.
    pRenderNode->SetPoints(ropePoints.data(), ropePoints.max_size());
}