Skip to content
< All Topics

RigidPart

The Experior.Core.Parts.RigidPart class is the base abstract class to encapsulate rigid bodies that are used by the NVIDIA PhysX engine.

Some important classes that derive from RigidPart are RigidSensorPart (used by sensors) and RigidLoadPart (used inside loads).

Methods & Properties related to attaching loads.

The methods below are used to attach loads to a rigidpart and keep them at a given relative position and orientation to the RigidPart. For the physics engine the loads are no longer dynamic actors that are moved according to forces and torques that are applied to them, but instead the loads become kinematic objects after attaching them to a RigidPart. You can use these method e.g. to attach a load to a gripper of a robot or keep it on a fast moving shuttle.

Note: There is an important distinction between the different Attach methods related to the collision of the load with a sensor. This distinction is necessary due to a limitation of the PhysX engine. The physics engine does not give a notification if you use the program to change the position of a load that is in contact with a sensor. Therefore, in attach methods that change the position/orientation of the load the load is taken out of the sensors it was colliding with by the programming (generating the Leave event of the sensor to allow reacting upon this change).

Attach(Load load): This method will attach the given load to the current RigidPart.This implies that if the RigidPart moves/rotates that the attached load will move with it, keeping its relative position/orientation as when it was attached. When the load was colliding with a sensor the Leave event of the sensor is not called (see Note above).

Attach(List<Load> loads): This method will attach all loads from the given list to the current RigidPart. When the loads were colliding with a sensor the Leave event of the sensor is not called (see Note above).

Attach(Load load, Vector3 localposition): This method will attach the given load to the current RigidPart at the given relative localposition from the origin of the rigidpart.

Attach(Load load, Vector3 localposition, float localyaw, float localpitch, float localroll): This method will attach the given load to the current RigidPart at the given relative localposition from the origin of the rigidpart and with a relative orientation determined by the given localyaw, localpitch,localroll Euler angles.

Attach(Load load, Vector3 localposition, Matrix localorientation): This method will attach the given load to the current RigidPart at the given relative localposition from the origin of the rigidpart and with a relative orientation determined by the given orientation matrix localorientation.

Attach(List<Load> loads, List<Vector3> positions, List<Matrix> orientations): This method will attach all loads from the given list to the current RigidPart. The given positions list and given orientations list contains the releative position and relative orientation for the load with the same index in the loads list.

UnAttach(Load load): Unattach the given load from the current RigidPart and make it a dynamic actor again for the physics engine.

UnAttach(): Unattach all loads that are attached to the current RigidPart and make them dynamic actors again for the physics engine.

In the example below a load is attached to the sensor upon the Enter event.

private void Entering(Core.Parts.Sensors.RigidSensorPart sensor, object trigger)
{
    //already attached
    if (((Core.Loads.Load)trigger).IsAttached)
    return;
    //avoid that the load gets selected
    ((Core.Loads.Load)trigger).Selectable = false;
    //attach load at current relative position/orientation to the sensor part
    sensor.Attach((Core.Loads.Load)trigger);
}

Methods & Properties related to PhysX interaction.

Actor Actor: This property sets/returns the instance of the Experior.PhysX.Actor class representing this RigidPart which is used inside the NVIDIA PhysX engine (NxActor class). Actors are the main objects in a physx simulation.

Experior.Core.Parts.Friction Friction: This property sets/returns the friction definition for this RigidPart as used by the physics engine. The Experior.Core.Parts.Friction class defines the static and the dynamic friction and has some predefined Friction configurations for the user’s convenience. These are Friction.Coefficients.SlippyFriction.Coefficients.StickyFriction.Coefficients.Smooth & Friction.Coefficients.None. When you require more control over the static and dynamic friction values used for your RigidPart then you can provide custom values for the Static and Dynamic property of the Friction property when using Friction.Coefficients.Custom.

var cube = new Experior.Core.Parts.Cube(System.Drawing.Color.DarkGray, info.length, info.height, info.width);
cube.Friction.Coefficient = Friction.Coefficients.Slippy;

bool Kinematic: By setting the Kinematic property to true, the rigidpart is made a kinematic object instead of a dynamic one. This implies that the part will no longer respond to the forces applied to it and the position and orientation of the part is controlled by the user. When kinematic is false then the part is considered a dynamic object for the physics engine.

Methods & Properties related to relative positioning.

bool Configured: This getter property returns true when the RigidPart is added to a parent object (e.g. assembly) and positioned using the LocalPosition, LocalYaw, properties. 

float LocalYaw: This getter/setter property reflects the rotation angle (in radians) of the RigidPart around the Y-axis of its parent object. 

float LocalPitch: This getter/setter property reflects the rotation angle (in radians) of the RigidPart around the X-axis of its parent object. 

float LocalRoll: This getter/setter property reflects the rotation angle (in radians) of the RigidPart around the Z-axis of its parent object. 

Matrix LocalOrientation: This property returns or sets the relative orientation of the RigidPart with respect to its parent object as defined in the Microsoft.DirectX.Matrix structure

Vector3 LocalPosition: This property returns or sets the relative 3 dimensional coordinates of the center of the RigidPart with respect to its parent object

Methods & Properties related to editing.

bool Dragable: Tthis getter/setter property controls whether you can drag the RigidPart, e.g. The start and end fixpoints in the conveyor assemblies are Dragable by default to allow the user to change the length of the conveyor by dragging the fixpoints to another position.
bool Locked: This getter/setter property allows to lock/unlock the RigidPart. When the part is locked it will change color to Colors.LOCKEDCOLOR (Yellow by default).
bool Selectable: This getter/setter property allows to control whether the RigidPart can be selected (e.g. by clicking on it).
IEntity Parent: This getter property returns the parent entity  form the RigidPart. If a RigidPart is added to an Assembly using then the Parent will return this Assembly.

RenderingMode RenderOption: This getter/setter property is used to get/set how the RigidPart should be rendered. The following values are possible:

Primitive: The part will only be rendered when the Experior.Core.Environment.Scene.PresentationLevel of Experior is Core.Environment.Scene.PresentationLevels.Primitives

PrimitiveAndNormal: The part will only be rendered when the Experior.Core.Environment.Scene.PresentationLevel is Scene.PresentationLevels.Primitives or Scene.PresentationLevels.Normal or Scene.PresentationLevels.Detailed or only its wireframe when Scene.PresentationLevels.Wireframe.

Normal: The part will only be rendered when the Experior.Core.Environment.Scene.PresentationLevel is Scene.PresentationLevels.Normal, Scene.PresentationLevels.Detailed or only its wireframe when Scene.PresentationLevels.Wireframe

Transparent: The part will only be rendered transparently (you can see through it) when the Experior.Core.Environment.Scene.PresentationLevel is Scene.PresentationLevels.Normal, Scene.PresentationLevels.Detailed. Note: Transparency is only visible in Locked mode, in Edit mode the part is rendered nontransparent.

TransparentPrimitiveAndNormal: The part will only be rendered transparently (you can see through it) when the Experior.Core.Environment.Scene.PresentationLevel is Scene.PresentationLevels.Normal, Scene.PresentationLevels.Detailed and Scene.PresentationLevels.Primitives. Note: Transparency is only visible in Locked mode, in Edit mode the part is rendered nontransparent.

Was this article helpful?
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.