CursorSpringConnector Class Reference
#include <CursorSpringConnector.h>
Inherits PhysicsObjectInterface, SystemThreadListenerInterface, and SimulationStepListenerInterface.

Public Types | |
| enum | CONNECTION_MODE { VELOCITY_MODE, SPRING_MODE, FORCETORQUE_MODE, JOINT_MODE } |
| Possible modes for connection. More... | |
Public Member Functions | |
| CursorSpringConnector (PhysicsEntity *entity, User *user) | |
| virtual | ~CursorSpringConnector () |
| virtual void | getRigidBodies (std::vector< oops::RigidBody * > &rigidBodyList) |
| virtual void | getJoints (std::vector< oops::Joint * > &jointList) |
| virtual PhysicsObjectID | getPhysicsObjectID () |
| virtual bool | handleMessage (NetMessage *msg) |
| virtual void | setPhysicsObjectManager (PhysicsObjectManager *objectManager) |
Static Public Member Functions | |
| static void | setLinearConstants (float spring, float damping) |
| static void | setAngularConstants (float spring, float damping) |
Static Public Attributes | |
| static const unsigned | CURSORSPRINGCONNECTOR_CLASSID = 3 |
| ID for CursorSpringConnector-class. | |
Protected Member Functions | |
| virtual void | executeVelocityMode (float dt, TransformationData cursorTrans, TransformationData bodyTrans) |
| virtual void | executeSpringMode (float dt, TransformationData cursorTrans, TransformationData bodyTrans) |
| virtual void | executeForceTorqueMode (float dt, TransformationData cursorTrans, TransformationData bodyTrans) |
| virtual void | executeJointMode (float dt, TransformationData cursorTrans, TransformationData bodyTrans) |
| virtual bool | initialize () |
| virtual void | systemUpdate (float dt) |
| virtual void | step (float dt, unsigned simulationTime) |
Protected Attributes | |
| bool | isInitialized |
| Indicating if the CursorSpringConnector is already initialized. | |
| PhysicsObjectID | physicsObjectID |
| ID of the CursorSpringConnector. | |
| CONNECTION_MODE | connectionMode |
| mode which is used for connection | |
| PhysicsObjectManager * | objectManager |
| Pointer to the used PhysicsObjectManager. | |
| User * | user |
| Owner of the Cursor used for manipulation. | |
| PhysicsEntity * | entity |
| PhysicsEntity which should be manipulated. | |
| oops::RigidBody * | rigidBody |
| RigidBody of PhysicsEntity. | |
| oops::RigidBody * | cursorBody |
| ODE-RigidBody for JointMode. | |
| oops::SpringDamperJoint * | connectionJoint |
| TransformationData | cursorToBodyOffset |
| Offset from Cursor to RigidBody transformation. | |
| TransformationData | bodyToCursorOffset |
| Offset from RigidBody to Cursor transformation. | |
| TransformationData | oldCursorTransformation |
| Cursor transformation from last simulation step. | |
| TransformationData | cursorTransformation |
| Current Cursor transformation. | |
| OSG::Lock * | cursorTransformationLock |
| Lock for updating Cursor transformation. | |
| uint64_t | rigidBodyId |
Static Protected Attributes | |
| static float | linearSpringConstant = 1.0f |
| Spring constants. | |
| static float | angularSpringConstant = 0.01f |
| static float | linearDampingConstant = 100.f |
| Damping constants. | |
| static float | angularDampingConstant = 10.f |
| static float | linearThreshold = 1.f |
| Thresholds where connection will break. | |
| static float | angularThreshold = M_PI |
Detailed Description
Class to connect a PhysicsEntity to the User's Cursor. This class is used for Natural Interaction when a PhysicsEntity should be manipulated with the Users's cursor. It tries to update the position of the Entity so that it matches to the one of the Cursor. Available modes: Velocity Mode: sets object-velocities directly- also called GOD-MODE: mass does not affect manipulation
- very stable
- problems with tires of corvette
Spring Mode: simulates a spring between cursor and RigidBody
- different manipulation depending of object mass
- hard to configure to work with all objects properly
- problems with objects which are connected to other objects via joints
- good for use with simple RigidBodies
Force Mode: calculates force and torque needed to reach velocities needed to fix transformation.
- TODO
Member Enumeration Documentation
Constructor & Destructor Documentation
| CursorSpringConnector::CursorSpringConnector | ( | PhysicsEntity * | entity, | |
| User * | user | |||
| ) |
Constructor.
- Parameters:
-
entity Entity which should be manipulated user owner of the cursor
| CursorSpringConnector::~CursorSpringConnector | ( | ) | [virtual] |
Empty Destructor.
Member Function Documentation
| void CursorSpringConnector::executeForceTorqueMode | ( | float | dt, | |
| TransformationData | cursorTrans, | |||
| TransformationData | bodyTrans | |||
| ) | [protected, virtual] |
Executes the manipulation in Force Mode
- Parameters:
-
dt timestep since last call cursorTrans transformation of the Cursor bodyTrans transformation of the RigidBody
| void CursorSpringConnector::executeJointMode | ( | float | dt, | |
| TransformationData | cursorTrans, | |||
| TransformationData | bodyTrans | |||
| ) | [protected, virtual] |
| void CursorSpringConnector::executeSpringMode | ( | float | dt, | |
| TransformationData | cursorTrans, | |||
| TransformationData | bodyTrans | |||
| ) | [protected, virtual] |
Executes the manipulation in Spring Mode
- Parameters:
-
dt timestep since last call cursorTrans transformation of the Cursor bodyTrans transformation of the RigidBody
| void CursorSpringConnector::executeVelocityMode | ( | float | dt, | |
| TransformationData | cursorTrans, | |||
| TransformationData | bodyTrans | |||
| ) | [protected, virtual] |
Executes the manipulation in Velocity Mode
- Parameters:
-
dt timestep since last call cursorTrans transformation of the Cursor bodyTrans transformation of the RigidBody
| virtual void CursorSpringConnector::getJoints | ( | std::vector< oops::Joint * > & | jointList | ) | [virtual] |
Fills the passed list with all Joints it contains. It is mainly used by the PhysicsObjectManager to add the Joints to the simulation.
- Parameters:
-
jointList List which is filled with contained Joints
Implements PhysicsObjectInterface.
| PhysicsObjectID CursorSpringConnector::getPhysicsObjectID | ( | ) | [virtual] |
Adds the PhysicsObject to the passed simulation instance.
- Parameters:
-
simulation oops::Simulation class instance
- Returns:
- true if the object could be added, false otherwise Removes the PhysicsObject from the passed simulation instance.
- Parameters:
-
simulation oops::Simulation class instance
- Returns:
- true if the object could be removed, false otherwise Returns the ID of the PhysicsObject. The method has to return the unique PhysicsObjectID of the PhysicsObject. The programmer has to ensure that this PhysicsObjectID is set properly and that it is unique.
ID of the PhysicsObject
Implements PhysicsObjectInterface.
| virtual void CursorSpringConnector::getRigidBodies | ( | std::vector< oops::RigidBody * > & | rigidBodyList | ) | [virtual] |
Fills the passed list with all RigidBodies it contains. It is mainly used by the PhysicsObjectManager to add the RigidBodies to the simulation.
- Parameters:
-
rigidBodyList List which is filled with contained RigidBodies
Implements PhysicsObjectInterface.
| bool CursorSpringConnector::handleMessage | ( | NetMessage * | msg | ) | [virtual] |
| bool CursorSpringConnector::initialize | ( | ) | [protected, virtual] |
| void CursorSpringConnector::setAngularConstants | ( | float | spring, | |
| float | damping | |||
| ) | [static] |
| void CursorSpringConnector::setLinearConstants | ( | float | spring, | |
| float | damping | |||
| ) | [static] |
| void CursorSpringConnector::setPhysicsObjectManager | ( | PhysicsObjectManager * | objectManager | ) | [virtual] |
Transforms the incoming Message into a message call. The method is called from the PhysicsObjectManager. It has to decode the passed Message and call the method call encoded in it.
- Parameters:
-
msg Message containing a method call
- Returns:
- true if the encoded method could be called, false otherwise Sets the PhysicsObjectManager responsible for the object. The method has to store the PhysicsObjectManager in order to call the handleClientInput method if a change in the physical state of the PhysicsObject should take place (e.g. via a user input)
- Parameters:
-
objectManager PhysicsObjectManager responsible for the object
Implements PhysicsObjectInterface.
| void CursorSpringConnector::step | ( | float | dt, | |
| unsigned | simulationTime | |||
| ) | [protected, virtual] |
Callback function when Physics::step is called. This method is called from the Physics Thread when a simulation step will be initiated. The passed argument defines the timestep which will be simulated. The real simulation step takes place after this method call.
- Parameters:
-
dt timestep of the next simulation step simulationTime time of the simulation
Implements SimulationStepListenerInterface.
| void CursorSpringConnector::systemUpdate | ( | float | dt | ) | [protected, virtual] |
Callback function when Physics::update is called. The method is called from the System Thread when the Physics::update method is called. It allows to update data which is needed by the System Thread, for example the transformation of an object. The method call runs parallel to the Physics Thread so take care to Lock data which can be accessible from both Threads!
- Parameters:
-
dt elapsed time since last call in seconds
Implements SystemThreadListenerInterface.
Member Data Documentation
float CursorSpringConnector::angularDampingConstant = 10.f [static, protected] |
float CursorSpringConnector::angularSpringConstant = 0.01f [static, protected] |
float CursorSpringConnector::angularThreshold = M_PI [static, protected] |
Offset from RigidBody to Cursor transformation.
CONNECTION_MODE CursorSpringConnector::connectionMode [protected] |
mode which is used for connection
oops::RigidBody* CursorSpringConnector::cursorBody [protected] |
ODE-RigidBody for JointMode.
OSG_USING_NAMESPACE const unsigned CursorSpringConnector::CURSORSPRINGCONNECTOR_CLASSID = 3 [static] |
ID for CursorSpringConnector-class.
Offset from Cursor to RigidBody transformation.
Current Cursor transformation.
OSG::Lock* CursorSpringConnector::cursorTransformationLock [protected] |
Lock for updating Cursor transformation.
PhysicsEntity* CursorSpringConnector::entity [protected] |
PhysicsEntity which should be manipulated.
bool CursorSpringConnector::isInitialized [protected] |
Indicating if the CursorSpringConnector is already initialized.
float CursorSpringConnector::linearDampingConstant = 100.f [static, protected] |
Damping constants.
float CursorSpringConnector::linearSpringConstant = 1.0f [static, protected] |
Spring constants.
float CursorSpringConnector::linearThreshold = 1.f [static, protected] |
Thresholds where connection will break.
PhysicsObjectManager* CursorSpringConnector::objectManager [protected] |
Pointer to the used PhysicsObjectManager.
Cursor transformation from last simulation step.
ID of the CursorSpringConnector.
oops::RigidBody* CursorSpringConnector::rigidBody [protected] |
uint64_t CursorSpringConnector::rigidBodyId [protected] |
User* CursorSpringConnector::user [protected] |
Owner of the Cursor used for manipulation.
The documentation for this class was generated from the following files:
- src/inVRs/Modules/3DPhysics/CursorSpringConnector.h
- src/inVRs/Modules/3DPhysics/CursorSpringConnector.cpp
Generated on Wed Oct 20 16:11:55 2010 for inVRs by
1.5.8