opal-commits Mailing List for Open Physics Abstraction Layer (Page 18)
Status: Inactive
Brought to you by:
tylerstreeter
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
(162) |
Mar
(134) |
Apr
(113) |
May
(13) |
Jun
(60) |
Jul
(18) |
Aug
(25) |
Sep
|
Oct
(2) |
Nov
(35) |
Dec
(76) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(3) |
Apr
(8) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
(1) |
Mar
(12) |
Apr
(16) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
|
Nov
|
Dec
(3) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(15) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: tylerstreeter <tyl...@us...> - 2005-03-31 08:44:03
|
Update of /cvsroot/opal/opal/samples/data/textures In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16389/textures Log Message: Directory /cvsroot/opal/opal/samples/data/textures added to the repository |
|
From: tylerstreeter <tyl...@us...> - 2005-03-31 08:43:46
|
Update of /cvsroot/opal/opal/samples/data/materials In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16389/materials Log Message: Directory /cvsroot/opal/opal/samples/data/materials added to the repository |
|
From: tylerstreeter <tyl...@us...> - 2005-03-31 08:43:46
|
Update of /cvsroot/opal/opal/samples/data/models In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16389/models Log Message: Directory /cvsroot/opal/opal/samples/data/models added to the repository |
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/src Modified Files: AccelerationSensor.cpp AttractorMotor.cpp AttractorMotor.h Defines.h GearedMotor.cpp InclineSensor.cpp InclineSensor.h InclineSensorData.h Joint.h Motor.h RaycastSensor.cpp Sensor.h ServoMotor.cpp Simulator.cpp Simulator.h SpringMotor.cpp SpringMotor.h ThrusterMotor.cpp ThrusterMotor.h Vec3r.h VolumeSensor.cpp Log Message: implemented InclineSensor; added code for Ogre sample apps Index: Sensor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Sensor.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Sensor.h 23 Mar 2005 04:04:30 -0000 1.10 --- Sensor.h 30 Mar 2005 23:26:22 -0000 1.11 *************** *** 38,44 **** /// environment. Each Sensor maintains a transform matrix; depending /// on whether the Sensor is attached to a Solid, the transform is ! /// relative to the attached Solid or the global origin. All Sensors ! /// start out disabled and must be initialized (via init) before they ! /// can be enabled. class Sensor { --- 38,43 ---- /// environment. Each Sensor maintains a transform matrix; depending /// on whether the Sensor is attached to a Solid, the transform is ! /// relative to the attached Solid or the global origin. Most Sensors ! /// remain ineffective until they are initialized. class Sensor { *************** *** 48,53 **** virtual ~Sensor(); ! /// Sets whether the Sensor can update its measurements. If the ! /// Sensor has not yet been initialized, this will have no effect. virtual void OPAL_CALL setEnabled(bool e) = 0; --- 47,51 ---- virtual ~Sensor(); ! /// Sets whether the Sensor can update its measurements. virtual void OPAL_CALL setEnabled(bool e) = 0; Index: Vec3r.h =================================================================== RCS file: /cvsroot/opal/opal/src/Vec3r.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Vec3r.h 29 Mar 2005 03:05:46 -0000 1.13 --- Vec3r.h 30 Mar 2005 23:26:23 -0000 1.14 *************** *** 295,299 **** inline bool areCollinear(const Vec3r& u, const Vec3r& v) { ! if (dot(u, v) < globals::OPAL_EPSILON) { return true; --- 295,300 ---- inline bool areCollinear(const Vec3r& u, const Vec3r& v) { ! real value = 1 - dot(u, v); ! if (fabs(value) < globals::OPAL_EPSILON) { return true; Index: Motor.h =================================================================== RCS file: /cvsroot/opal/opal/src/Motor.h,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Motor.h 23 Mar 2005 04:04:30 -0000 1.38 --- Motor.h 30 Mar 2005 23:26:22 -0000 1.39 *************** *** 43,49 **** /// attain a desired state, users should use a Motor that takes a /// desired position or velocity, automatically applying forces every ! /// time step to attain that state. All Motors start out ! /// disabled and must be initialized via init before they can be ! /// enabled. class Motor { --- 43,48 ---- /// attain a desired state, users should use a Motor that takes a /// desired position or velocity, automatically applying forces every ! /// time step to attain that state. Most Motors remain ineffective ! /// until they are initialized. class Motor { *************** *** 53,58 **** virtual ~Motor(); ! /// Sets whether the Motor has any effect. If the Motor has not ! /// yet been initialized, this will have no effect. virtual void OPAL_CALL setEnabled(bool e) = 0; --- 52,56 ---- virtual ~Motor(); ! /// Sets whether the Motor has any effect. virtual void OPAL_CALL setEnabled(bool e) = 0; Index: Simulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.h,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** Simulator.h 25 Mar 2005 02:44:20 -0000 1.91 --- Simulator.h 30 Mar 2005 23:26:22 -0000 1.92 *************** *** 45,48 **** --- 45,49 ---- class ThrusterMotor; class AccelerationSensor; + class InclineSensor; class RaycastSensor; class VolumeSensor; *************** *** 222,225 **** --- 223,229 ---- virtual AccelerationSensor* OPAL_CALL createAccelerationSensor(); + /// Creates and returns a pointer to an InclineSensor. + virtual InclineSensor* OPAL_CALL createInclineSensor(); + /// Creates and returns a pointer to a RaycastSensor. virtual RaycastSensor* OPAL_CALL createRaycastSensor(); Index: InclineSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/InclineSensor.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InclineSensor.cpp 29 Mar 2005 03:05:46 -0000 1.1 --- InclineSensor.cpp 30 Mar 2005 23:26:22 -0000 1.2 *************** *** 34,37 **** --- 34,39 ---- { // "mData" is initialized in its own constructor. + // "mLocalReferenceVec" is initialized in its own constructor. + // "mInitGlobalReferenceVec" is initialized in its own constructor. } *************** *** 44,47 **** --- 46,52 ---- Sensor::init(); mData = data; + + // Define the current setup as zero degrees. + setupInternalVectors(); } *************** *** 58,71 **** } ! //TODO: calc angle ! return 0; // temp } void InclineSensor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 63,108 ---- } ! // By this time setupInternalVectors should have been called, so ! // the mLocalReferenceVec and mInitGlobalReferenceVec vectors are ! // valid. ! ! // Let's call the plane orthogonal to the rotation axis the ! // "plane of rotation." The local reference vector is currently on ! // the plane of rotation. We need to get the initial global ! // reference vector projected onto the plane of rotation. ! ! Vec3r currentGlobalReferenceVec = mData.solid->getTransform() * ! mLocalReferenceVec; ! ! if (areCollinear(mInitGlobalReferenceVec, currentGlobalReferenceVec)) ! { ! // Return zero degrees if the initial global reference vector ! // is collinear with the current global reference vector. ! return 0; ! } ! ! Vec3r tempVec = cross(mData.axis, mInitGlobalReferenceVec); ! Vec3r u = cross(mData.axis, tempVec); ! ! // Now 'u' should be on the plane of rotation. We just need to ! // project the initial global reference vector onto it. ! ! Vec3r projInitGlobalReferenceVec = project(u, ! mInitGlobalReferenceVec); ! ! // Now calculate the angle between the projected global reference ! // vector and the current global reference vector. ! real angle = angleBetween(projInitGlobalReferenceVec, ! currentGlobalReferenceVec); ! ! return angle; } void InclineSensor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 79,84 **** void InclineSensor::setAxis(const Vec3r& axis) { ! //TODO: redefine angle as zero degrees mData.axis = axis; } --- 116,128 ---- void InclineSensor::setAxis(const Vec3r& axis) { ! if (!mData.solid) ! { ! return; ! } ! mData.axis = axis; + + // Redefine the current setup as zero degrees. + setupInternalVectors(); } *************** *** 93,96 **** --- 137,150 ---- } + void InclineSensor::setTransform(const Matrix44r& t) + { + mData.transform = t; + } + + const Matrix44r& InclineSensor::getTransform()const + { + return mData.transform; + } + void InclineSensor::setName(const std::string& name) { *************** *** 105,109 **** void InclineSensor::internal_update() { ! if (mData.enabled) { // Do nothing. --- 159,163 ---- void InclineSensor::internal_update() { ! if (mData.enabled && mData.solid) { // Do nothing. *************** *** 122,124 **** --- 176,207 ---- } } + + void InclineSensor::setupInternalVectors() + { + if (!mData.solid) + { + return; + } + + // We need to calculate a local reference vector that's orthogonal + // to the rotation axis. + + // This temporary vector can be anything as long as its not + // collinear with the rotation axis. + Vec3r tempVec(1, 0, 0); + + if (areCollinear(mData.axis, tempVec)) + { + // Pick a new tempVec. + tempVec.set(0, 1, 0); + } + + // Now we can get the orthogonal reference vector. + mLocalReferenceVec = cross(mData.axis, tempVec); + + // Also store a copy of this reference vector in its initial global + // representation. + mInitGlobalReferenceVec = mData.solid->getTransform() * + mLocalReferenceVec; + } } Index: SpringMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/SpringMotor.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SpringMotor.h 23 Mar 2005 04:52:36 -0000 1.13 --- SpringMotor.h 30 Mar 2005 23:26:23 -0000 1.14 *************** *** 46,57 **** virtual ~SpringMotor(); ! /// Sets up the Motor to affect a Solid. Also specifies which ! /// degrees of freedom are affected by the Motor. This will ! /// enable the Motor. Calling this more than once will detach the ! /// Motor from its Solid and attach it to a new Solid. ! //virtual void OPAL_CALL init(Mode m, Solid* s); ! ! /// Initializes the Motor with the given data structure. Solid ! /// pointer in the data must be valid. virtual void OPAL_CALL init(const SpringMotorData& data); --- 46,51 ---- virtual ~SpringMotor(); ! /// Initializes the Motor with the given data structure. If the ! /// Solid pointer in the data are NULL, the Motor will do nothing. virtual void OPAL_CALL init(const SpringMotorData& data); *************** *** 70,78 **** /// Sets the spring's attach point on the Solid. This is a local ! // offset point from the Solid's position. ! virtual void OPAL_CALL setAttachOffset(const Point3r& offset); ! /// Returns the spring's attach point on the Solid. ! virtual const Point3r& OPAL_CALL getAttachOffset()const; /// Sets the desired position and orientation. --- 64,81 ---- /// Sets the spring's attach point on the Solid. This is a local ! /// offset point from the Solid's position. ! virtual void OPAL_CALL setLocalAttachOffset(const Point3r& offset); ! /// Returns the spring's attach point on the Solid. This is a local ! /// offset point from the Solid's position. ! virtual const Point3r& OPAL_CALL getLocalAttachOffset()const; ! ! /// Sets the spring's attach point on the Solid in global ! /// coordinates. ! virtual void OPAL_CALL setGlobalAttachPoint(const Point3r& p); ! ! /// Returns the spring's attach point on the Solid in global ! /// coordinates. ! virtual Point3r OPAL_CALL getGlobalAttachPoint()const; /// Sets the desired position and orientation. Index: InclineSensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/InclineSensorData.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InclineSensorData.h 29 Mar 2005 03:05:46 -0000 1.1 --- InclineSensorData.h 30 Mar 2005 23:26:22 -0000 1.2 *************** *** 42,46 **** { mType = INCLINE_SENSOR; ! // "axis" is initialized in its own constructor. } --- 42,46 ---- { mType = INCLINE_SENSOR; ! axis = defaults::sensor::incline::axis; } Index: ThrusterMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/ThrusterMotor.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ThrusterMotor.h 23 Mar 2005 04:04:31 -0000 1.13 --- ThrusterMotor.h 30 Mar 2005 23:26:23 -0000 1.14 *************** *** 51,57 **** //virtual void OPAL_CALL init(Solid* solid); ! /// Initializes the Motor with the given data structure. The Solid ! /// pointer in the data must be valid. The Force in this data ! /// structure will automatically be set to a "single step" Force. virtual void OPAL_CALL init(const ThrusterMotorData& data); --- 51,58 ---- //virtual void OPAL_CALL init(Solid* solid); ! /// Initializes the Motor with the given data structure. If the ! /// Solid pointer in the data are NULL, the Motor will do nothing. ! /// The Force in this data structure will automatically be set to a ! /// "single step" Force. virtual void OPAL_CALL init(const ThrusterMotorData& data); Index: InclineSensor.h =================================================================== RCS file: /cvsroot/opal/opal/src/InclineSensor.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InclineSensor.h 29 Mar 2005 03:05:46 -0000 1.1 --- InclineSensor.h 30 Mar 2005 23:26:22 -0000 1.2 *************** *** 55,60 **** /// Initializes the Sensor with the given data structure. This will /// define the rotation angle as zero degrees when called. The Solid ! /// pointer should always be valid because this Sensor only works ! /// when attached to something. virtual void OPAL_CALL init(const InclineSensorData& data); --- 55,61 ---- /// Initializes the Sensor with the given data structure. This will /// define the rotation angle as zero degrees when called. The Solid ! /// pointer should be valid because this Sensor only works when ! /// attached to something. This does nothing if the Sensor's Solid ! /// pointer is NULL. virtual void OPAL_CALL init(const InclineSensorData& data); *************** *** 72,76 **** /// Sets the local rotation axis around which the angle of rotation /// will be measured. This will redefine the rotation angle as zero ! /// degrees when called. virtual void OPAL_CALL setAxis(const Vec3r& axis); --- 73,78 ---- /// Sets the local rotation axis around which the angle of rotation /// will be measured. This will redefine the rotation angle as zero ! /// degrees when called. This does nothing if the Sensor's Solid ! /// pointer is NULL. virtual void OPAL_CALL setAxis(const Vec3r& axis); *************** *** 78,81 **** --- 80,87 ---- virtual const Vec3r& OPAL_CALL getAxis(); + virtual void OPAL_CALL setTransform(const Matrix44r& t); + + virtual const Matrix44r& OPAL_CALL getTransform()const; + virtual SensorType OPAL_CALL getType()const; *************** *** 89,95 **** --- 95,111 ---- protected: + /// A helper function that sets up all internal vectors used when + /// calculating the angle of rotation. + void setupInternalVectors(); + /// Stores data describing the Sensor. InclineSensorData mData; + /// A vector used to measure the angle of rotation. + Vec3r mLocalReferenceVec; + + /// A vector used to measure the angle of rotation. + Vec3r mInitGlobalReferenceVec; + private: }; Index: AccelerationSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/AccelerationSensor.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AccelerationSensor.cpp 29 Mar 2005 03:05:45 -0000 1.5 --- AccelerationSensor.cpp 30 Mar 2005 23:26:21 -0000 1.6 *************** *** 108,115 **** void AccelerationSensor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 108,115 ---- void AccelerationSensor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 148,152 **** void AccelerationSensor::internal_update() { ! if (mData.enabled) { mCurrentGlobalLinearVel = --- 148,152 ---- void AccelerationSensor::internal_update() { ! if (mData.enabled && mData.solid) { mCurrentGlobalLinearVel = Index: GearedMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/GearedMotor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GearedMotor.cpp 23 Mar 2005 04:04:30 -0000 1.11 --- GearedMotor.cpp 30 Mar 2005 23:26:22 -0000 1.12 *************** *** 84,91 **** void GearedMotor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 84,91 ---- void GearedMotor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 94,98 **** void GearedMotor::internal_update() { ! if (mData.enabled) { // Global/local direction makes no difference here since --- 94,98 ---- void GearedMotor::internal_update() { ! if (mData.enabled && mData.joint) { // Global/local direction makes no difference here since Index: AttractorMotor.h =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.h,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** AttractorMotor.h 23 Mar 2005 04:04:30 -0000 1.28 --- AttractorMotor.h 30 Mar 2005 23:26:22 -0000 1.29 *************** *** 48,58 **** virtual ~AttractorMotor(); ! /// Sets up the Motor to attract two Solids to each other. This will ! /// enable the Motor. Calling this more than once will detach the ! /// Motor from its Solids and attach it to new Solids. ! //virtual void OPAL_CALL init(Solid* solid0, Solid* solid1); ! ! /// Initializes the Motor with the given data structure. Solid ! /// pointers in the data must be valid. virtual void OPAL_CALL init(const AttractorMotorData& data); --- 48,53 ---- virtual ~AttractorMotor(); ! /// Initializes the Motor with the given data structure. If the ! /// Solid pointers in the data are NULL, the Motor will do nothing. virtual void OPAL_CALL init(const AttractorMotorData& data); Index: ThrusterMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ThrusterMotor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ThrusterMotor.cpp 23 Mar 2005 04:04:31 -0000 1.11 --- ThrusterMotor.cpp 30 Mar 2005 23:26:23 -0000 1.12 *************** *** 50,54 **** void ThrusterMotor::init(const ThrusterMotorData& data) { - assert(data.solid); Motor::init(); mData = data; --- 50,53 ---- *************** *** 83,90 **** void ThrusterMotor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 82,89 ---- void ThrusterMotor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 93,97 **** void ThrusterMotor::internal_update() { ! if (mData.enabled) { mData.solid->addForce(mData.force); --- 92,96 ---- void ThrusterMotor::internal_update() { ! if (mData.enabled && mData.solid) { mData.solid->addForce(mData.force); Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Simulator.cpp 29 Mar 2005 03:05:46 -0000 1.53 --- Simulator.cpp 30 Mar 2005 23:26:22 -0000 1.54 *************** *** 841,844 **** --- 841,851 ---- } + InclineSensor* Simulator::createInclineSensor() + { + InclineSensor* newSensor = new InclineSensor(); + addSensor(newSensor); + return newSensor; + } + RaycastSensor* Simulator::createRaycastSensor() { Index: RaycastSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/RaycastSensor.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RaycastSensor.cpp 23 Mar 2005 20:24:36 -0000 1.8 --- RaycastSensor.cpp 30 Mar 2005 23:26:22 -0000 1.9 *************** *** 59,88 **** const RaycastResult& RaycastSensor::fireRay(real length) { ! Rayr ray = mData.ray; ! ! // If the Sensor is attached to a Solid, we need to transform ! // the ray relative to that Solid's transform. ! if (mData.solid) { ! ray = mData.solid->getTransform() * ray; ! } ! // Use the Sensor's transform on the ray. ! ray = mData.transform * ray; ! // If this is attached to a Solid, the Simulator raycast function ! // will automatically ignore intersections between the ray and ! // that Solid. ! return mSim->internal_fireRay(ray, length, mData.solid, ! mData.contactGroup); } void RaycastSensor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 59,96 ---- const RaycastResult& RaycastSensor::fireRay(real length) { ! if (mData.enabled) { ! Rayr ray = mData.ray; ! // If the Sensor is attached to a Solid, we need to transform ! // the ray relative to that Solid's transform. ! if (mData.solid) ! { ! ray = mData.solid->getTransform() * ray; ! } ! // Use the Sensor's transform on the ray. ! ray = mData.transform * ray; ! // If this is attached to a Solid, the Simulator raycast function ! // will automatically ignore intersections between the ray and ! // that Solid. ! ! return mSim->internal_fireRay(ray, length, mData.solid, ! mData.contactGroup); ! } ! else ! { ! static RaycastResult junkResult; ! return junkResult; ! } } void RaycastSensor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 131,135 **** void RaycastSensor::internal_update() { ! if (mData.enabled) { // Do nothing. --- 139,143 ---- void RaycastSensor::internal_update() { ! if (mData.enabled && mData.solid) { // Do nothing. Index: Defines.h =================================================================== RCS file: /cvsroot/opal/opal/src/Defines.h,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Defines.h 13 Mar 2005 23:40:53 -0000 1.69 --- Defines.h 30 Mar 2005 23:26:22 -0000 1.70 *************** *** 374,377 **** --- 374,383 ---- { const bool enabled = true; + + /// Default parameters used in InclineSensor creation. + namespace incline + { + const Vec3r axis = Vec3r(1, 0, 0); + } } Index: VolumeSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/VolumeSensor.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VolumeSensor.cpp 23 Mar 2005 04:04:31 -0000 1.4 --- VolumeSensor.cpp 30 Mar 2005 23:26:23 -0000 1.5 *************** *** 54,98 **** const VolumeQueryResult& VolumeSensor::queryVolume(Solid* volume) { ! // The volume Solid's transform will be totally ignored. ! // Store the volume Solid's transform. ! Matrix44r originalVolumeTransform = volume->getTransform(); ! Matrix44r newVolumeTransform; ! // If the Sensor is attached to a Solid, we need to transform ! // the volume relative to that Solid's transform. ! if (mData.solid) ! { ! newVolumeTransform = ! mData.solid->getTransform() * newVolumeTransform; ! } ! // Use the Sensor's transform on the volume. ! newVolumeTransform = mData.transform * newVolumeTransform; ! // Set the volume's new transform we just setup. ! volume->setTransform(newVolumeTransform); ! // If this is attached to a Solid, the Simulator volume query ! // function will automatically ignore intersections between the ! // volume and that Solid. ! // Query the volume for colliding Solids. ! const VolumeQueryResult& result = ! mSim->internal_queryVolume(volume, mData.solid); ! // Restore the volume Solid's original transform. ! volume->setTransform(originalVolumeTransform); ! return result; } void VolumeSensor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 54,106 ---- const VolumeQueryResult& VolumeSensor::queryVolume(Solid* volume) { ! if (mData.enabled) ! { ! // The volume Solid's transform will be totally ignored. ! // Store the volume Solid's transform. ! Matrix44r originalVolumeTransform = volume->getTransform(); ! Matrix44r newVolumeTransform; ! // If the Sensor is attached to a Solid, we need to transform ! // the volume relative to that Solid's transform. ! if (mData.solid) ! { ! newVolumeTransform = ! mData.solid->getTransform() * newVolumeTransform; ! } ! // Use the Sensor's transform on the volume. ! newVolumeTransform = mData.transform * newVolumeTransform; ! // Set the volume's new transform we just setup. ! volume->setTransform(newVolumeTransform); ! // If this is attached to a Solid, the Simulator volume query ! // function will automatically ignore intersections between the ! // volume and that Solid. ! // Query the volume for colliding Solids. ! const VolumeQueryResult& result = ! mSim->internal_queryVolume(volume, mData.solid); ! // Restore the volume Solid's original transform. ! volume->setTransform(originalVolumeTransform); ! return result; ! } ! else ! { ! static VolumeQueryResult junkResult; ! return junkResult; ! } } void VolumeSensor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 131,135 **** void VolumeSensor::internal_update() { ! if (mData.enabled) { // Do nothing. --- 139,143 ---- void VolumeSensor::internal_update() { ! if (mData.enabled && mData.solid) { // Do nothing. Index: SpringMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/SpringMotor.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SpringMotor.cpp 23 Mar 2005 04:52:36 -0000 1.11 --- SpringMotor.cpp 30 Mar 2005 23:26:23 -0000 1.12 *************** *** 43,47 **** void SpringMotor::init(const SpringMotorData& data) { - assert(data.solid); Motor::init(); mData = data; --- 43,46 ---- *************** *** 75,82 **** void SpringMotor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 74,81 ---- void SpringMotor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 87,91 **** // Note: this only applies to global position and orientation. ! if (mData.enabled) { if (LINEAR_MODE == mData.mode || --- 86,90 ---- // Note: this only applies to global position and orientation. ! if (mData.enabled && mData.solid) { if (LINEAR_MODE == mData.mode || *************** *** 170,183 **** } ! void SpringMotor::setAttachOffset(const Point3r& offset) { mData.attachOffset = offset; } ! const Point3r& SpringMotor::getAttachOffset()const { return mData.attachOffset; } void SpringMotor::setDesiredTransform(const Matrix44r& transform) { --- 169,219 ---- } ! void SpringMotor::setLocalAttachOffset(const Point3r& offset) { mData.attachOffset = offset; } ! const Point3r& SpringMotor::getLocalAttachOffset()const { return mData.attachOffset; } + void SpringMotor::setGlobalAttachPoint(const Point3r& p) + { + if (!mData.solid) + { + OPAL_LOGGER("warning") << + "opal::SpringMotor::setGlobalAttachPoint: Solid pointer is \ + invalid. Ignoring request." << std::endl; + return; + } + + // Convert the global point to an offset from the Solid's transform. + Vec3r relVec = p - mData.solid->getPosition(); + Point3r relPos(relVec[0], relVec[1], relVec[2]); + mData.attachOffset = mData.solid->getTransform() * relPos; + } + + Point3r SpringMotor::getGlobalAttachPoint()const + { + if (!mData.solid) + { + OPAL_LOGGER("warning") << + "opal::SpringMotor::getGlobalAttachPoint: Solid pointer is \ + invalid. Returning (0,0,0)." << std::endl; + return Point3r(); + } + + // The global position is a combination of the Solid's global + // transform and the spring's local offset from the Solid's + // transform. + Vec3r offset(mData.attachOffset[0], mData.attachOffset[1], + mData.attachOffset[2]); + Point3r globalPos = mData.solid->getPosition() + + mData.solid->getTransform() * offset; + + return globalPos; + } + void SpringMotor::setDesiredTransform(const Matrix44r& transform) { Index: Joint.h =================================================================== RCS file: /cvsroot/opal/opal/src/Joint.h,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Joint.h 23 Mar 2005 04:04:30 -0000 1.66 --- Joint.h 30 Mar 2005 23:26:22 -0000 1.67 *************** *** 51,56 **** /// do not use all of the anchor and axis parameters. An unused anchor /// or axis will be ignored (see the JointType description for more ! /// details). All Joints start out disabled and must be initialized ! /// via init before they can be enabled. class Joint { --- 51,55 ---- /// do not use all of the anchor and axis parameters. An unused anchor /// or axis will be ignored (see the JointType description for more ! /// details). Joints remain ineffective until they are initialized. class Joint { Index: AttractorMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotor.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** AttractorMotor.cpp 23 Mar 2005 04:04:30 -0000 1.21 --- AttractorMotor.cpp 30 Mar 2005 23:26:22 -0000 1.22 *************** *** 58,69 **** void AttractorMotor::init(const AttractorMotorData& data) { - assert(data.solid0 && data.solid1); Motor::init(); mData = data; - mSolid0Mass = data.solid0->getMass(); - mSolid1Mass = data.solid1->getMass(); ! // Update this constant since the masses changed. ! mMassConstant = data.strength * mSolid0Mass * mSolid1Mass; } --- 58,72 ---- void AttractorMotor::init(const AttractorMotorData& data) { Motor::init(); mData = data; ! if (data.solid0 && data.solid1) ! { ! mSolid0Mass = data.solid0->getMass(); ! mSolid1Mass = data.solid1->getMass(); ! ! // Update this constant since the masses changed. ! mMassConstant = data.strength * mSolid0Mass * mSolid1Mass; ! } } *************** *** 95,102 **** void AttractorMotor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 98,105 ---- void AttractorMotor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 105,109 **** void AttractorMotor::internal_update() { ! if (mData.enabled) { Point3r pos1 = mData.solid0->getPosition(); --- 108,112 ---- void AttractorMotor::internal_update() { ! if (mData.enabled && mData.solid0 && mData.solid1) { Point3r pos1 = mData.solid0->getPosition(); Index: ServoMotor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ServoMotor.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ServoMotor.cpp 23 Mar 2005 04:04:30 -0000 1.15 --- ServoMotor.cpp 30 Mar 2005 23:26:22 -0000 1.16 *************** *** 48,69 **** } - //void ServoMotor::init(Mode m, Joint* j, int axisNum) - //{ - // if (mInitCalled) - // { - // // If the Servo is already in operation, we first need to - // // set the Joint's desired vel and max force to 0. The - // // following function call will automatically handle this - // // when set to false. - // setEnabled(false); - // } - - // Motor::init(); - // assert(axisNum >= 0 && axisNum < j->getNumAxes()); - // mJoint = j; - // mMode = m; - // mJointAxis = axisNum; - //} - void ServoMotor::init(const ServoMotorData& data) { --- 48,51 ---- *************** *** 112,119 **** void ServoMotor::setEnabled(bool e) { ! if (!mInitCalled) ! { ! return; ! } mData.enabled = e; --- 94,101 ---- void ServoMotor::setEnabled(bool e) { ! //if (!mInitCalled) ! //{ ! // return; ! //} mData.enabled = e; *************** *** 138,142 **** void ServoMotor::internal_update() { ! if (mData.enabled) { // Make sure both Solids are awake at this point. --- 120,124 ---- void ServoMotor::internal_update() { ! if (mData.enabled && mData.joint) { // Make sure both Solids are awake at this point. |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:27:23
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745 Modified Files: changelog.txt todo.txt Log Message: implemented InclineSensor; added code for Ogre sample apps Index: changelog.txt =================================================================== RCS file: /cvsroot/opal/opal/changelog.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** changelog.txt 23 Mar 2005 20:24:30 -0000 1.13 --- changelog.txt 30 Mar 2005 23:26:21 -0000 1.14 *************** *** 6,10 **** * Added CollisionEventHandler, JointBreakEventHandler, and PostStepEventHandler * Collision events now get queued up during collision detection and handled at the end of each time step ! * Added AccelerationSensor, RaycastSensor, & VolumeSensor * Overhauled XML loading system; now all Solid, Shape, Joint, Motor, and Sensor data can be loaded from OPAL XML files * Joints have a parameter to allow contacts between connected Solids or not --- 6,10 ---- * Added CollisionEventHandler, JointBreakEventHandler, and PostStepEventHandler * Collision events now get queued up during collision detection and handled at the end of each time step ! * Added AccelerationSensor, InclineSensor, RaycastSensor, and VolumeSensor * Overhauled XML loading system; now all Solid, Shape, Joint, Motor, and Sensor data can be loaded from OPAL XML files * Joints have a parameter to allow contacts between connected Solids or not Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** todo.txt 29 Mar 2005 03:05:47 -0000 1.63 --- todo.txt 30 Mar 2005 23:26:21 -0000 1.64 *************** *** 2,5 **** --- 2,7 ---- ================= + * finish testing incline sensor - maybe with picking system? + * incline/orientation sensor: takes a local rotation axis; measures the angle the Solid has moved around that local axis; returns a real value (angle in degrees) - doesn't use teh sensor's transform *************** *** 15,24 **** - add to Blueprint addSensor/addMotor function ! * add license notice to samples' source files ! * clean up samples * comment math functions For Version 0.4.0 ================= --- 17,36 ---- - add to Blueprint addSensor/addMotor function ! * samples ! - clean up old ones OR make new ones ! - add license to all source files ! * build (and distribute) with ode dll? * comment math functions + * finish web todo for 0.3.0 + + * update change log + + * update readme files + + * add ogre plugins.cfg and resources.cfg files to samples for non-win32 + For Version 0.4.0 ================= *************** *** 64,67 **** --- 76,81 ---- ============== + * given that the physics engine is known at compile time, just set the opal::real to the physics engine's real value (e.g. ODE's dReal) + * GearedMotor - talk to Jim Bernard |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:27:05
|
Update of /cvsroot/opal/opal/samples/simple_objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/samples/simple_objects Modified Files: main.cpp Log Message: implemented InclineSensor; added code for Ogre sample apps Index: main.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/simple_objects/main.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** main.cpp 28 Mar 2005 22:33:06 -0000 1.27 --- main.cpp 30 Mar 2005 23:26:21 -0000 1.28 *************** *** 26,31 **** float gCameraZoom; float gCameraYPos; ! int gOldMousePos[2]; bool gMouseButtonsPressed[2]; opal::Simulator* gSimulator=NULL; std::vector<Base3DObject*> gObjects; --- 26,34 ---- float gCameraZoom; float gCameraYPos; ! int gMousePosScreen[2]; ! //float gMousePosWorld[2]; bool gMouseButtonsPressed[2]; + const float gRotateSpeed = 3; + const float gZoomSpeed = 3; opal::Simulator* gSimulator=NULL; std::vector<Base3DObject*> gObjects; *************** *** 65,68 **** --- 68,81 ---- void setupVisualShapes(opal::Solid* s); void makeRagdoll(); + opal::Point3r getGlobalMousePos(); + void drawPickingSpring(); + + // Picking stuff. + opal::RaycastSensor* gRaySensor = NULL; + opal::SpringMotor* gPickingSpring = NULL; + GLUquadricObj* gQuadric = NULL; + + opal::Solid* gSensorSolid = NULL; + opal::InclineSensor* gSensor = NULL; int main(int argc, char **argv) *************** *** 93,96 **** --- 106,135 ---- gGround->addShape(planeData); + // Create the objects used for picking. + gPickingSpring = gSimulator->createSpringMotor(); + gPickingSpring->setEnabled(false); + //opal::SpringMotorData motorData; + //gPickingSpring->init(motorData); + gRaySensor = gSimulator->createRaycastSensor(); + opal::RaycastSensorData rayData; + gRaySensor->init(rayData); + gQuadric = gluNewQuadric(); + + // testing... + gSensorSolid = gSimulator->createSolid(); + opal::Matrix44r t; + t.translate(0, 5, 0); + gSensorSolid->setTransform(t); + opal::BoxShapeData boxData; + gSensorSolid->addShape(boxData); + BoxObject* newBox = new BoxObject(gSimulator, gSensorSolid, + boxData.dimensions, boxData.offset); + gObjects.push_back(newBox); + gSensor = gSimulator->createInclineSensor(); + opal::InclineSensorData sensorData; + sensorData.solid = gSensorSolid; + sensorData.axis.set(1, 0, 0); + gSensor->init(sensorData); + std::cout << "==============================================" << std::endl; std::cout << " OPAL Objects Test" << std::endl; *************** *** 121,124 **** --- 160,164 ---- gSimulator->destroy(); + gluDeleteQuadric(gQuadric); return 0; *************** *** 236,241 **** gWindowHeight = INITIAL_WINDOW_HEIGHT; gAspectRatio = (float)gWindowWidth/(float)gWindowHeight; ! gOldMousePos[0] = 0; ! gOldMousePos[1] = 0; gMouseButtonsPressed[0] = false; gMouseButtonsPressed[1] = false; --- 276,281 ---- gWindowHeight = INITIAL_WINDOW_HEIGHT; gAspectRatio = (float)gWindowWidth/(float)gWindowHeight; ! gMousePosScreen[0] = 0; ! gMousePosScreen[1] = 0; gMouseButtonsPressed[0] = false; gMouseButtonsPressed[1] = false; *************** *** 347,350 **** --- 387,393 ---- SDL_Event event; + // Get the dt since the last frame. + opal::real dt = (opal::real)gTimer.GetElapsedSeconds(); + while (SDL_PollEvent(&event)) //handle events until event queue is empty { *************** *** 356,377 **** int clickPosX = event.button.x; ! int clickPosY = gWindowHeight - event.button.y; switch (event.button.button) { case SDL_BUTTON_LEFT: ! //if (event.button.state == SDL_PRESSED) ! //{ ! gMouseButtonsPressed[0] = true; ! gOldMousePos[0] = clickPosX; ! gOldMousePos[1] = clickPosY; ! //} break; case SDL_BUTTON_RIGHT: //if (event.button.state == SDL_PRESSED) //{ gMouseButtonsPressed[1] = true; ! gOldMousePos[0] = clickPosX; ! gOldMousePos[1] = clickPosY; //} break; --- 399,447 ---- int clickPosX = event.button.x; ! //int clickPosY = gWindowHeight - event.button.y; ! int clickPosY = event.button.y; switch (event.button.button) { case SDL_BUTTON_LEFT: ! { ! gMouseButtonsPressed[0] = true; ! gMousePosScreen[0] = clickPosX; ! gMousePosScreen[1] = clickPosY; ! ! // Fire a ray to find an object to pick. ! opal::Rayr r; ! opal::Point3r origin;// = getGlobalMousePos(); ! r.setOrigin(origin); ! //opal::Vec3r dir(0, 0, -10000); ! opal::Vec3r dir(getGlobalMousePos().getData()); ! r.setDir(dir); ! gRaySensor->setRay(r); ! opal::RaycastResult result = ! gRaySensor->fireRay(); ! ! std::cout << "Origin: [" << origin[0] << " " ! << origin[1] << " " << origin[2] ! << "] Dir: [" << dir[0] << " " ! << dir[1] << " " << dir[2] << "]" ! << std::endl; ! ! if (result.solid) ! { ! // Setup spring for picking. ! opal::SpringMotorData data; ! data.solid = result.solid; ! gPickingSpring->init(data); ! gPickingSpring->setGlobalAttachPoint( ! result.intersection); ! } break; + } case SDL_BUTTON_RIGHT: //if (event.button.state == SDL_PRESSED) //{ gMouseButtonsPressed[1] = true; ! gMousePosScreen[0] = clickPosX; ! gMousePosScreen[1] = clickPosY; //} break; *************** *** 389,392 **** --- 459,463 ---- case SDL_BUTTON_LEFT: gMouseButtonsPressed[0] = false; + gPickingSpring->setEnabled(false); break; case SDL_BUTTON_RIGHT: *************** *** 408,428 **** int clickPosY = gWindowHeight - event.button.y; ! int deltaMouse[2]; ! deltaMouse[0] = clickPosX - gOldMousePos[0]; ! deltaMouse[1] = clickPosY - gOldMousePos[1]; ! ! gOldMousePos[0] = clickPosX; ! gOldMousePos[1] = clickPosY; ! ! if (gMouseButtonsPressed[0] == true) ! { ! gCameraRotY += deltaMouse[0]*0.3f; ! gCameraRotX -= deltaMouse[1]*0.3f; ! } ! if (gMouseButtonsPressed[1]==true) ! { ! gCameraZoom -= deltaMouse[1]*0.3f; ! } ! break; } --- 479,484 ---- int clickPosY = gWindowHeight - event.button.y; ! gMousePosScreen[0] = clickPosX; ! gMousePosScreen[1] = clickPosY; break; } *************** *** 431,434 **** --- 487,508 ---- switch(event.key.keysym.sym) { + case SDLK_LEFT: + gCameraRotY -= gRotateSpeed; + break; + case SDLK_RIGHT: + gCameraRotY += gRotateSpeed; + break; + case SDLK_UP: + gCameraRotX -= gRotateSpeed; + break; + case SDLK_DOWN: + gCameraRotX += gRotateSpeed; + break; + case SDLK_a: + gCameraZoom -= gZoomSpeed; + break; + case SDLK_z: + gCameraZoom += gZoomSpeed; + break; case SDLK_ESCAPE: //fall through case SDLK_q: *************** *** 438,441 **** --- 512,524 ---- gPaused = !gPaused; break; + case SDLK_t: + { + opal::Force t; + t.type = opal::GLOBAL_TORQUE; + t.vec.set(0, 0, 10); + t.duration = (opal::real)0.02; + gSensorSolid->addForce(t); + break; + } //case SDLK_m: // if (METAL == gObjectMaterialType) *************** *** 693,697 **** // Advance the physics simulation. - opal::real dt = (opal::real)gTimer.GetElapsedSeconds(); if (!gPaused) { --- 776,779 ---- *************** *** 706,716 **** } // Update the performance calculations. ++gFrameCounter; gPerfTimer += dt; ! if (gPerfTimer >= gPerfOutputPeriod) { ! std::cout << ((opal::real)gFrameCounter) / gPerfTimer << ! " fps" << std::endl; gPerfTimer = 0; gFrameCounter = 0; --- 788,810 ---- } + drawPickingSpring(); + + //// Update the performance calculations. + //++gFrameCounter; + //gPerfTimer += dt; + //if (gPerfTimer >= gPerfOutputPeriod) + //{ + // std::cout << ((opal::real)gFrameCounter) / gPerfTimer << + // " fps" << std::endl; + // gPerfTimer = 0; + // gFrameCounter = 0; + //} + // Update the performance calculations. ++gFrameCounter; gPerfTimer += dt; ! if (gPerfTimer >= 0.2) { ! std::cout << gSensor->getAngle() << std::endl; gPerfTimer = 0; gFrameCounter = 0; *************** *** 723,724 **** --- 817,863 ---- } } + + opal::Point3r getGlobalMousePos() + { + // Get the mouse position in world coords. + double mvMat[16], projMat[16]; + int viewport[4]; + glGetDoublev(GL_MODELVIEW_MATRIX, mvMat); + glGetDoublev(GL_PROJECTION_MATRIX, projMat); + glGetIntegerv(GL_VIEWPORT, viewport); + double o[3]; + gluUnProject(gMousePosScreen[0], + gMousePosScreen[0], 0, mvMat, projMat, + viewport, &o[0], &o[1], &o[2]); + + return opal::Point3r((opal::real)o[0], (opal::real)o[1], + (opal::real)o[2]); + } + + void drawPickingSpring() + { + if (!gPickingSpring->isEnabled()) + { + return; + } + + glPushAttrib(GL_LIGHTING); + glDisable(GL_LIGHTING); + + // Draw a sphere at the mouse position. + opal::Point3r mousePosWorld = getGlobalMousePos(); + glPushMatrix(); + glTranslatef(mousePosWorld[0], mousePosWorld[1], 0); + gluSphere(gQuadric, 1, 20, 20); + glPopMatrix(); + + // Draw a sphere at the intersection position. + opal::Point3r globalAttachPos = gPickingSpring->getGlobalAttachPoint(); + glPushMatrix(); + glTranslatef(globalAttachPos[0], globalAttachPos[1], + globalAttachPos[2]); + gluSphere(gQuadric, 1, 20, 20); + glPopMatrix(); + + glPopAttrib(); + } |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:26:51
|
Update of /cvsroot/opal/opal/tools/blender In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/tools/blender Added Files: readme.txt Log Message: implemented InclineSensor; added code for Ogre sample apps --- NEW FILE: readme.txt --- The current Blender exporter script in this directory is outdated and should not be used. |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:26:36
|
Update of /cvsroot/opal/opal/samples/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/samples/src Added Files: BaseOpalApp.h ExampleApplication.h ExampleFrameListener.h TemplateApp.cpp Log Message: implemented InclineSensor; added code for Ogre sample apps --- NEW FILE: TemplateApp.cpp --- #include <time.h> #include "../src/BaseOpalApp.h" namespace myAppNamespace { class MyApp : public BaseOpalApp { public: MyApp() : BaseOpalApp() { mUseShadows = true; } ~MyApp() {} protected: virtual void createScene() { // Setup shadows. if (mUseShadows) { mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); } else { mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); } // Set the ambient light level. mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); // Create a light source. Ogre::Light* light = mSceneMgr->createLight("light0"); light->setType(Ogre::Light::LT_POINT); light->setPosition(-80.0, 30.0, -10.0); // Load models, create physical objects, etc. here. } virtual bool appFrameStarted(opal::real dt) { // Do per-frame application specific things here. // Return true to continue looping. return true; } virtual bool processUnbufferedKeyInput(Ogre::Real dt) { // Check if we should quit looping. if(mInputDevice->isKeyDown(KC_ESCAPE) || mInputDevice->isKeyDown(KC_Q)) { return false; } // The following code can be used to update a camera's position. if (mInputDevice->isKeyDown(KC_LEFT)) { // Move camera left. } else if (mInputDevice->isKeyDown(KC_RIGHT)) { // Move camera right. } else if (mInputDevice->isKeyDown(KC_UP)) { // Move camera forward. } else if (mInputDevice->isKeyDown(KC_DOWN)) { // Move camera backward. } else { // Stop camera motion if necessary. } // Toggle shadows. if( mInputDevice->isKeyDown(KC_S)) { mUseShadows = !mUseShadows; if (mUseShadows) { mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); } else { mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); } // Set this to keep from handling the key press // continually while it is down. mTimeUntilNextToggle = 0.5; } // Toggle HUD. if (mInputDevice->isKeyDown(KC_H) && mTimeUntilNextToggle <= 0) { mStatsOn = !mStatsOn; showDebugOverlay(mStatsOn); mTimeUntilNextToggle = 1; } // Handy screenshot saving procedure. if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0) { char tmp[20]; sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots); ExampleApplication::mWindow->writeContentsToFile(tmp); ExampleApplication::mWindow->setDebugText(String("Wrote ") + tmp); // Set this to keep from handling the key press // continually while it is down. mTimeUntilNextToggle = 0.5; } // Return true to continue looping. return true; } virtual bool processUnbufferedMouseInput(Ogre::Real dt) { // The following code checks the mouse button state. if (true == mInputDevice->getMouseButton(0)) { // The left mouse button is down. } else { // The left mouse button is up. } // The following code checks how far the mouse has move since // the last poll. This data can be used to rotate the camera // around its X and Y axes (yaw and pitch, respectively). Ogre::Real rotX = -mInputDevice->getMouseRelativeX(); Ogre::Real rotY = -mInputDevice->getMouseRelativeY(); // Return true to continue looping. return true; } private: /// Used to toggle shadows on and off. bool mUseShadows; }; } int main(int argc, char **argv) { srand(time(NULL)); SET_TERM_HANDLER; myAppNamespace::MyApp app; try { app.go(); } catch(Ogre::Exception& e) { std::cerr << "An exception has occured: " << e.getFullDescription().c_str() << std::endl; } return 0; } --- NEW FILE: ExampleApplication.h --- /* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2005 The OGRE Team Also see acknowledgements in Readme.html You may use this sample code for anything you like, it is not covered by the LGPL like the rest of the engine. ----------------------------------------------------------------------------- */ /* ----------------------------------------------------------------------------- Filename: ExampleApplication.h Description: Base class for all the OGRE examples ----------------------------------------------------------------------------- */ #ifndef __ExampleApplication_H__ #define __ExampleApplication_H__ #include <ogre/Ogre.h> #include <ogre/OgreConfigFile.h> #include "ExampleFrameListener.h" using namespace Ogre; /** Base class which manages the standard startup of an Ogre application. Designed to be subclassed for specific examples if required. */ class ExampleApplication { public: /// Standard constructor ExampleApplication() { mFrameListener = 0; mRoot = 0; } /// Standard destructor virtual ~ExampleApplication() { if (mFrameListener) delete mFrameListener; if (mRoot) delete mRoot; } /// Start the example virtual void go(void) { if (!setup()) return; mRoot->startRendering(); // clean up destroyScene(); } protected: Root *mRoot; Camera* mCamera; SceneManager* mSceneMgr; ExampleFrameListener* mFrameListener; RenderWindow* mWindow; // These internal methods package up the stages in the startup process /** Sets up the application - returns false if the user chooses to abandon configuration. */ virtual bool setup(void) { mRoot = new Root(); setupResources(); bool carryOn = configure(); if (!carryOn) return false; chooseSceneManager(); createCamera(); createViewports(); // Set default mipmap level (NB some APIs ignore this) TextureManager::getSingleton().setDefaultNumMipmaps(5); // Create any resource listeners (for loading screens) createResourceListener(); // Load resources loadResources(); // Create the scene createScene(); createFrameListener(); return true; } /** Configures the application - returns false if the user chooses to abandon configuration. */ virtual bool configure(void) { // Show the configuration dialog and initialise the system // You can skip this and use root.restoreConfig() to load configuration // settings if you were sure there are valid ones saved in ogre.cfg if(mRoot->showConfigDialog()) { // If returned true, user clicked OK so initialise // Here we choose to let the system create a default rendering window by passing 'true' mWindow = mRoot->initialise(true); return true; } else { return false; } } virtual void chooseSceneManager(void) { // Get the SceneManager, in this case a generic one mSceneMgr = mRoot->getSceneManager(ST_GENERIC); } virtual void createCamera(void) { // Create the camera mCamera = mSceneMgr->createCamera("PlayerCam"); // Position it at 500 in Z direction mCamera->setPosition(Vector3(0,0,500)); // Look back along -Z mCamera->lookAt(Vector3(0,0,-300)); mCamera->setNearClipDistance(5); } // This function was modifed for the Opal sample apps. virtual void createFrameListener() { //mFrameListener= new ExampleFrameListener(mWindow, mCamera); //mFrameListener->showDebugOverlay(true); //mRoot->addFrameListener(mFrameListener); } virtual void createScene(void) = 0; // pure virtual - this has to be overridden virtual void destroyScene(void){} // Optional to override this virtual void createViewports(void) { // Create one viewport, entire window Viewport* vp = mWindow->addViewport(mCamera); vp->setBackgroundColour(ColourValue(0,0,0)); // Alter the camera aspect ratio to match the viewport mCamera->setAspectRatio( Real(vp->getActualWidth()) / Real(vp->getActualHeight())); } /// Method which will define the source of resources (other than current folder) virtual void setupResources(void) { // Load resource paths from config file ConfigFile cf; cf.load("resources.cfg"); // Go through all sections & settings in the file ConfigFile::SectionIterator seci = cf.getSectionIterator(); String secName, typeName, archName; while (seci.hasMoreElements()) { secName = seci.peekNextKey(); ConfigFile::SettingsMultiMap *settings = seci.getNext(); ConfigFile::SettingsMultiMap::iterator i; for (i = settings->begin(); i != settings->end(); ++i) { typeName = i->first; archName = i->second; ResourceGroupManager::getSingleton().addResourceLocation( archName, typeName, secName); } } } /// Optional override method where you can create resource listeners (e.g. for loading screens) virtual void createResourceListener(void) { } /// Optional override method where you can perform resource group loading /// Must at least do ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); virtual void loadResources(void) { // Initialise, parse scripts etc ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); } }; #endif --- NEW FILE: ExampleFrameListener.h --- /* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2005 The OGRE Team Also see acknowledgements in Readme.html You may use this sample code for anything you like, it is not covered by the LGPL like the rest of the engine. ----------------------------------------------------------------------------- */ /* ----------------------------------------------------------------------------- Filename: ExampleFrameListener.h Description: Defines an example frame listener which responds to frame events. This frame listener just moves a specified camera around based on keyboard and mouse movements. Mouse: Freelook W or Up: Forward S or Down:Backward A: Step left D: Step right PgUp: Move upwards PgDown: Move downwards F: Toggle frame rate stats on/off R: Render mode T: Cycle texture filtering Bilinear, Trilinear, Anisotropic(8) P: Toggle on/off display of camera position / orientation ----------------------------------------------------------------------------- */ #ifndef __ExampleFrameListener_H__ #define __ExampleFrameListener_H__ #include <ogre/Ogre.h> #include <ogre/OgreKeyEvent.h> #include <ogre/OgreEventListeners.h> #include <ogre/OgreStringConverter.h> #include <ogre/OgreException.h> using namespace Ogre; class ExampleFrameListener: public FrameListener, public KeyListener { protected: int mSceneDetailIndex ; Real mMoveSpeed; Degree mRotateSpeed; Overlay* mDebugOverlay; void updateStats(void) { static String currFps = "Current FPS: "; static String avgFps = "Average FPS: "; static String bestFps = "Best FPS: "; static String worstFps = "Worst FPS: "; static String tris = "Triangle Count: "; // update stats when necessary try { OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps"); OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps"); OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps"); OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps"); const RenderTarget::FrameStats& stats = mWindow->getStatistics(); guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)); guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS)); guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS) +" "+StringConverter::toString(stats.bestFrameTime)+" ms"); guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS) +" "+StringConverter::toString(stats.worstFrameTime)+" ms"); OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); guiTris->setCaption(tris + StringConverter::toString((unsigned int)stats.triangleCount)); OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); guiDbg->setCaption(mWindow->getDebugText()); } catch(...) { // ignore } } public: // This constructor was changed from its normal behavior for Opal // sample apps. Warning: be sure to call init on instances of // this class after the Ogre root has been created! If you're deriving // your app from BaseOpalApp, you should be fine. ExampleFrameListener() {} // Takes a RenderWindow because it uses that to determine input context. // This function was added for Opal sample apps. void init(RenderWindow* win, Camera* cam, bool useBufferedInputKeys = false, bool useBufferedInputMouse = false) { mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay"); mUseBufferedInputKeys = useBufferedInputKeys; mUseBufferedInputMouse = useBufferedInputMouse; mInputTypeSwitchingOn = mUseBufferedInputKeys || mUseBufferedInputMouse; mRotateSpeed = 36; mMoveSpeed = 100; if (mInputTypeSwitchingOn) { mEventProcessor = new EventProcessor(); mEventProcessor->initialise(win); mEventProcessor->startProcessingEvents(); mEventProcessor->addKeyListener(this); mInputDevice = mEventProcessor->getInputReader(); } else { mInputDevice = PlatformManager::getSingleton().createInputReader(); mInputDevice->initialise(win,true, true); } mCamera = cam; mWindow = win; mStatsOn = true; mNumScreenShots = 0; mTimeUntilNextToggle = 0; mSceneDetailIndex = 0; mMoveScale = 0.0f; mRotScale = 0.0f; mTranslateVector = Vector3::ZERO; mAniso = 1; mFiltering = TFO_BILINEAR; showDebugOverlay(true); } virtual ~ExampleFrameListener() { if (mInputTypeSwitchingOn) { delete mEventProcessor; } else { PlatformManager::getSingleton().destroyInputReader( mInputDevice ); } } virtual bool processUnbufferedKeyInput(const FrameEvent& evt) { if (mInputDevice->isKeyDown(KC_A)) { // Move camera left mTranslateVector.x = -mMoveScale; } if (mInputDevice->isKeyDown(KC_D)) { // Move camera RIGHT mTranslateVector.x = mMoveScale; } /* Move camera forward by keypress. */ if (mInputDevice->isKeyDown(KC_UP) || mInputDevice->isKeyDown(KC_W) ) { mTranslateVector.z = -mMoveScale; } /* Move camera backward by keypress. */ if (mInputDevice->isKeyDown(KC_DOWN) || mInputDevice->isKeyDown(KC_S) ) { mTranslateVector.z = mMoveScale; } if (mInputDevice->isKeyDown(KC_PGUP)) { // Move camera up mTranslateVector.y = mMoveScale; } if (mInputDevice->isKeyDown(KC_PGDOWN)) { // Move camera down mTranslateVector.y = -mMoveScale; } if (mInputDevice->isKeyDown(KC_RIGHT)) { mCamera->yaw(-mRotScale); } if (mInputDevice->isKeyDown(KC_LEFT)) { mCamera->yaw(mRotScale); } if( mInputDevice->isKeyDown( KC_ESCAPE) ) { return false; } // see if switching is on, and you want to toggle if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_M) && mTimeUntilNextToggle <= 0) { switchMouseMode(); mTimeUntilNextToggle = 1; } if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_K) && mTimeUntilNextToggle <= 0) { // must be going from immediate keyboard to buffered keyboard switchKeyMode(); mTimeUntilNextToggle = 1; } if (mInputDevice->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0) { mStatsOn = !mStatsOn; showDebugOverlay(mStatsOn); mTimeUntilNextToggle = 1; } if (mInputDevice->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0) { switch(mFiltering) { case TFO_BILINEAR: mFiltering = TFO_TRILINEAR; mAniso = 1; break; case TFO_TRILINEAR: mFiltering = TFO_ANISOTROPIC; mAniso = 8; break; case TFO_ANISOTROPIC: mFiltering = TFO_BILINEAR; mAniso = 1; break; default: break; } MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering); MaterialManager::getSingleton().setDefaultAnisotropy(mAniso); showDebugOverlay(mStatsOn); mTimeUntilNextToggle = 1; } if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0) { char tmp[20]; sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots); mWindow->writeContentsToFile(tmp); mTimeUntilNextToggle = 0.5; mWindow->setDebugText(String("Wrote ") + tmp); } if (mInputDevice->isKeyDown(KC_R) && mTimeUntilNextToggle <=0) { mSceneDetailIndex = (mSceneDetailIndex+1)%3 ; switch(mSceneDetailIndex) { case 0 : mCamera->setDetailLevel(SDL_SOLID) ; break ; case 1 : mCamera->setDetailLevel(SDL_WIREFRAME) ; break ; case 2 : mCamera->setDetailLevel(SDL_POINTS) ; break ; } mTimeUntilNextToggle = 0.5; } static bool displayCameraDetails = false; if (mInputDevice->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0) { displayCameraDetails = !displayCameraDetails; mTimeUntilNextToggle = 0.5; if (!displayCameraDetails) mWindow->setDebugText(""); } if (displayCameraDetails) { // Print camera details mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) + " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation())); } // Return true to continue rendering return true; } bool processUnbufferedMouseInput(const FrameEvent& evt) { /* Rotation factors, may not be used if the second mouse button is pressed. */ /* If the second mouse button is pressed, then the mouse movement results in sliding the camera, otherwise we rotate. */ if( mInputDevice->getMouseButton( 1 ) ) { mTranslateVector.x += mInputDevice->getMouseRelativeX() * 0.13; mTranslateVector.y -= mInputDevice->getMouseRelativeY() * 0.13; } else { mRotX = Degree(-mInputDevice->getMouseRelativeX() * 0.13); mRotY = Degree(-mInputDevice->getMouseRelativeY() * 0.13); } return true; } void moveCamera() { // Make all the changes to the camera // Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW (e.g. airplane) mCamera->yaw(mRotX); mCamera->pitch(mRotY); mCamera->moveRelative(mTranslateVector); } void showDebugOverlay(bool show) { if (mDebugOverlay) { if (show) { mDebugOverlay->show(); } else { mDebugOverlay->hide(); } } } // Override frameStarted event to process that (don't care about frameEnded) bool frameStarted(const FrameEvent& evt) { if(mWindow->isClosed()) return false; if (!mInputTypeSwitchingOn) { mInputDevice->capture(); } if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys) { // one of the input modes is immediate, so setup what is needed for immediate mouse/key movement if (mTimeUntilNextToggle >= 0) mTimeUntilNextToggle -= evt.timeSinceLastFrame; // If this is the first frame, pick a speed if (evt.timeSinceLastFrame == 0) { mMoveScale = 1; mRotScale = 0.1; } // Otherwise scale movement units by time passed since last frame else { // Move about 100 units per second, mMoveScale = mMoveSpeed * evt.timeSinceLastFrame; // Take about 10 seconds for full rotation mRotScale = mRotateSpeed * evt.timeSinceLastFrame; } mRotX = 0; mRotY = 0; mTranslateVector = Vector3::ZERO; } if (mUseBufferedInputKeys) { // no need to do any processing here, it is handled by event processor and // you get the results as KeyEvents } else { if (processUnbufferedKeyInput(evt) == false) { return false; } } if (mUseBufferedInputMouse) { // no need to do any processing here, it is handled by event processor and // you get the results as MouseEvents } else { if (processUnbufferedMouseInput(evt) == false) { return false; } } if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys) { // one of the input modes is immediate, so update the movement vector moveCamera(); } return true; } bool frameEnded(const FrameEvent& evt) { updateStats(); return true; } void switchMouseMode() { mUseBufferedInputMouse = !mUseBufferedInputMouse; mInputDevice->setBufferedInput(mUseBufferedInputKeys, mUseBufferedInputMouse); } void switchKeyMode() { mUseBufferedInputKeys = !mUseBufferedInputKeys; mInputDevice->setBufferedInput(mUseBufferedInputKeys, mUseBufferedInputMouse); } void keyClicked(KeyEvent* e) { if (e->getKeyChar() == 'm') { switchMouseMode(); } else if (e->getKeyChar() == 'k') { switchKeyMode(); } } void keyPressed(KeyEvent* e) {} void keyReleased(KeyEvent* e) {} protected: EventProcessor* mEventProcessor; InputReader* mInputDevice; Camera* mCamera; Vector3 mTranslateVector; RenderWindow* mWindow; bool mStatsOn; bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn; unsigned int mNumScreenShots; float mMoveScale; Degree mRotScale; // just to stop toggles flipping too fast Real mTimeUntilNextToggle ; Radian mRotX, mRotY; TextureFilterOptions mFiltering; int mAniso; }; #endif --- NEW FILE: BaseOpalApp.h --- #ifndef BASE_OPAL_APP_H #define BASE_OPAL_APP_H #include "ExampleApplication.h" #include "ExampleFrameListener.h" #include <opal/opal.h> class BaseOpalApp : public ExampleApplication, public ExampleFrameListener { public: BaseOpalApp() : ExampleApplication(), ExampleFrameListener() { mSimulator = opal::createSimulator(); } ~BaseOpalApp() { mSimulator->destroy(); } protected: /// Register the frame listener with the Ogre root so it will /// call the listener at the appropriate time. virtual void createFrameListener() { ExampleFrameListener::init(ExampleApplication::mWindow, ExampleApplication::mCamera); mRoot->addFrameListener(this); } /// Initial scene setup function. Create and position lights, load /// models, create a camera, etc. virtual void createScene() = 0; /// Called once per frame after input and physics have been updated. /// This is a place for applications to do application-specific updates /// per frame. It takes the dt since the last frame as a parameter. /// This should return false if we should break out of the main loop. virtual bool appFrameStarted(opal::real dt) = 0; /// Called at the start of each frame. Calculate dt since the last /// frame, update input, update physics, etc. Returns false if we /// should break out of the main loop. Applications should not override /// this; instead, they should override 'appFrameStarted'. virtual bool frameStarted(const FrameEvent& evt) { if(ExampleApplication::mWindow->isClosed()) { return false; } Ogre::Real dt = evt.timeSinceLastFrame; if (false == handleInput(dt)) { return false; } // Simulate physics. mSimulator->simulate(dt); // Notify the application about the new frame. appFrameStarted((opal::real)dt); return true; } /// Returns false if we should break out of the main loop. bool handleInput(Ogre::Real dt) { // This variable can be used to keep keys from repeating too fast. if (mTimeUntilNextToggle >= 0) { mTimeUntilNextToggle -= dt; } // Acquire data from input devices. mInputDevice->capture(); // Handle keyboard input. if (processUnbufferedKeyInput(dt) == false) { return false; } // Handle mouse input. if (processUnbufferedMouseInput(dt) == false) { return false; } return true; } /// Process keyboard input here. Returns false if we should break out /// of the main loop. virtual bool processUnbufferedKeyInput(Ogre::Real dt) = 0; /// Process mouse input here. Returns false if we should break out of /// the main loop. virtual bool processUnbufferedMouseInput(Ogre::Real dt) = 0; /// Pointer to the OPAL Simulator. opal::Simulator* mSimulator; private: }; #endif |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:26:33
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/src/ODE Modified Files: ODESimulator.cpp Log Message: implemented InclineSensor; added code for Ogre sample apps Index: ODESimulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.cpp,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** ODESimulator.cpp 25 Mar 2005 02:44:20 -0000 1.94 --- ODESimulator.cpp 30 Mar 2005 23:26:23 -0000 1.95 *************** *** 756,760 **** ODESimulator* sim = (ODESimulator*)data; ! // Get pointers to the two geoms' GeomData structure. GeomData* geomData0 = ((GeomData*)dGeomGetData(o0)); GeomData* geomData1 = ((GeomData*)dGeomGetData(o1)); --- 756,761 ---- ODESimulator* sim = (ODESimulator*)data; ! // Get pointers to the two geoms' GeomData structure. Both ! // of these should always be non-NULL. GeomData* geomData0 = ((GeomData*)dGeomGetData(o0)); GeomData* geomData1 = ((GeomData*)dGeomGetData(o1)); *************** *** 815,827 **** // Colliding two geoms. // Get a pointer to the ODESimulator. ODESimulator* sim = (ODESimulator*)data; ! // Get pointers to the two geoms' GeomData structure. GeomData* geomData0 = ((GeomData*)dGeomGetData(o0)); GeomData* geomData1 = ((GeomData*)dGeomGetData(o1)); ! // Only one of these (the one NOT belonging to the ray geom) ! // will be non-NULL. unsigned int geomContactGroup = defaults::shape::contactGroup; if (geomData0) --- 816,836 ---- // Colliding two geoms. + // Sometimes we get a case where the ray geom is passed in + // as both objects, which is stupid. + if (o0 == o1) + { + return; + } + // Get a pointer to the ODESimulator. ODESimulator* sim = (ODESimulator*)data; ! // Get pointers to the two geoms' GeomData structure. One ! // of these (the one NOT belonging to the ray geom) ! // will always be non-NULL. GeomData* geomData0 = ((GeomData*)dGeomGetData(o0)); GeomData* geomData1 = ((GeomData*)dGeomGetData(o1)); ! // Find the contact group of the collided Solid. unsigned int geomContactGroup = defaults::shape::contactGroup; if (geomData0) |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:26:33
|
Update of /cvsroot/opal/opal/samples/data/packs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/samples/data/packs Added Files: OgreCore.zip Log Message: implemented InclineSensor; added code for Ogre sample apps --- NEW FILE: OgreCore.zip --- (This appears to be a binary file; contents omitted.) |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:26:33
|
Update of /cvsroot/opal/opal/samples/playpen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4745/samples/playpen Added Files: main.cpp playpen.sln playpen.vcproj Log Message: implemented InclineSensor; added code for Ogre sample apps --- NEW FILE: main.cpp --- #include <time.h> #include "../src/BaseOpalApp.h" namespace playpen { class PlaypenApp : public BaseOpalApp { public: PlaypenApp() : BaseOpalApp() { mUseShadows = true; } ~PlaypenApp() {} protected: virtual void createScene() { // Setup shadows. if (mUseShadows) { mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); } else { mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); } // Set the ambient light level. mSceneMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5)); // Create a light source. Ogre::Light* light = mSceneMgr->createLight("light0"); light->setType(Ogre::Light::LT_POINT); light->setPosition(-80.0, 30.0, -10.0); // Load models, create physical objects, etc. here. } virtual bool appFrameStarted(opal::real dt) { // Do per-frame application specific things here. // Return true to continue looping. return true; } virtual bool processUnbufferedKeyInput(Ogre::Real dt) { // Check if we should quit looping. if(mInputDevice->isKeyDown(KC_ESCAPE) || mInputDevice->isKeyDown(KC_Q)) { return false; } // The following code can be used to update a camera's position. if (mInputDevice->isKeyDown(KC_LEFT)) { // Move camera left. } else if (mInputDevice->isKeyDown(KC_RIGHT)) { // Move camera right. } else if (mInputDevice->isKeyDown(KC_UP)) { // Move camera forward. } else if (mInputDevice->isKeyDown(KC_DOWN)) { // Move camera backward. } else { // Stop camera motion if necessary. } // Toggle shadows. if( mInputDevice->isKeyDown(KC_S)) { mUseShadows = !mUseShadows; if (mUseShadows) { mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE); } else { mSceneMgr->setShadowTechnique(SHADOWTYPE_NONE); } // Set this to keep from handling the key press // continually while it is down. mTimeUntilNextToggle = 0.5; } // Toggle HUD. if (mInputDevice->isKeyDown(KC_H) && mTimeUntilNextToggle <= 0) { mStatsOn = !mStatsOn; showDebugOverlay(mStatsOn); mTimeUntilNextToggle = 1; } // Handy screenshot saving procedure. if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0) { char tmp[20]; sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots); ExampleApplication::mWindow->writeContentsToFile(tmp); ExampleApplication::mWindow->setDebugText(String("Wrote ") + tmp); // Set this to keep from handling the key press // continually while it is down. mTimeUntilNextToggle = 0.5; } // Return true to continue looping. return true; } virtual bool processUnbufferedMouseInput(Ogre::Real dt) { // The following code checks the mouse button state. if (true == mInputDevice->getMouseButton(0)) { // The left mouse button is down. } else { // The left mouse button is up. } // The following code checks how far the mouse has move since // the last poll. This data can be used to rotate the camera // around its X and Y axes (yaw and pitch, respectively). Ogre::Real rotX = -mInputDevice->getMouseRelativeX(); Ogre::Real rotY = -mInputDevice->getMouseRelativeY(); // Return true to continue looping. return true; } private: /// Used to toggle shadows on and off. bool mUseShadows; }; } int main(int argc, char **argv) { srand(time(NULL)); SET_TERM_HANDLER; playpen::PlaypenApp app; try { app.go(); } catch(Ogre::Exception& e) { std::cerr << "An exception has occured: " << e.getFullDescription().c_str() << std::endl; } return 0; } --- NEW FILE: playpen.sln --- Microsoft Visual Studio Solution File, Format Version 8.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "playpen", "playpen.vcproj", "{79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}" ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Debug.ActiveCfg = Debug|Win32 {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Debug.Build.0 = Debug|Win32 {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Release.ActiveCfg = Release|Win32 {79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection GlobalSection(ExtensibilityAddIns) = postSolution EndGlobalSection EndGlobal --- NEW FILE: playpen.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="playpen" ProjectGUID="{79955DA4-1E44-4CDB-83D1-C2E2A56DF1A6}" Keyword="Win32Proj"> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="Debug" IntermediateDirectory="Debug" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="ogremain_d.lib opal-ode_d.lib" OutputFile="$(OutDir)/playpen.exe" LinkIncremental="2" AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" ProgramDatabaseFile="$(OutDir)/playpen.pdb" SubSystem="1" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="Release" IntermediateDirectory="Release" ConfigurationType="1" CharacterSet="2"> <Tool Name="VCCLCompilerTool" GlobalOptimizations="TRUE" InlineFunctionExpansion="2" FavorSizeOrSpeed="1" AdditionalIncludeDirectories="" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="TRUE" DebugInformationFormat="3"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalDependencies="ogremain.lib opal-ode.lib" OutputFile="$(OutDir)/playpen.exe" LinkIncremental="1" AdditionalLibraryDirectories="" GenerateDebugInformation="TRUE" SubSystem="1" OptimizeReferences="2" EnableCOMDATFolding="2" TargetMachine="1"/> <Tool Name="VCMIDLTool"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> <File RelativePath=".\main.cpp"> </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:09:06
|
Update of /cvsroot/opal/opal/samples/data/packs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24504/packs Log Message: Directory /cvsroot/opal/opal/samples/data/packs added to the repository |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 23:08:29
|
Update of /cvsroot/opal/opal/samples/data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24159/data Log Message: Directory /cvsroot/opal/opal/samples/data added to the repository |
|
From: tylerstreeter <tyl...@us...> - 2005-03-30 20:56:53
|
Update of /cvsroot/opal/opal/samples/playpen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7856/playpen Log Message: Directory /cvsroot/opal/opal/samples/playpen added to the repository |
|
From: tylerstreeter <tyl...@us...> - 2005-03-29 03:06:00
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28949/src Modified Files: AccelerationSensor.cpp AccelerationSensor.h Blueprint.cpp BlueprintManager.cpp Matrix44r.h OpalMath.h RaycastSensorData.h SConscript SensorData.h Simulator.cpp Solid.cpp Vec3r.h opal.h Added Files: InclineSensor.cpp InclineSensor.h InclineSensorData.h Log Message: added some Vec3r functions; added InclineSensor Index: AccelerationSensor.h =================================================================== RCS file: /cvsroot/opal/opal/src/AccelerationSensor.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AccelerationSensor.h 23 Mar 2005 20:24:33 -0000 1.4 --- AccelerationSensor.h 29 Mar 2005 03:05:46 -0000 1.5 *************** *** 48,55 **** virtual ~AccelerationSensor(); ! /// Initializes the Sensor with the given data structure. If the ! /// Solid pointer in the data is valid, the Sensor's offset will ! /// be relative to the Solid's transform instead of the global ! /// origin. virtual void OPAL_CALL init(const AccelerationSensorData& data); --- 48,54 ---- virtual ~AccelerationSensor(); ! /// Initializes the Sensor with the given data structure. The Solid ! /// pointer should always be valid because this Sensor only works ! /// when attached to something. virtual void OPAL_CALL init(const AccelerationSensorData& data); Index: AccelerationSensor.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/AccelerationSensor.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AccelerationSensor.cpp 23 Mar 2005 20:24:32 -0000 1.4 --- AccelerationSensor.cpp 29 Mar 2005 03:05:45 -0000 1.5 *************** *** 64,68 **** Vec3r AccelerationSensor::getGlobalLinearAccel()const { ! if (!mData.solid) { return Vec3r(); --- 64,68 ---- Vec3r AccelerationSensor::getGlobalLinearAccel()const { ! if (!mData.enabled || !mData.solid) { return Vec3r(); *************** *** 75,79 **** Vec3r AccelerationSensor::getGlobalAngularAccel()const { ! if (!mData.solid) { return Vec3r(); --- 75,79 ---- Vec3r AccelerationSensor::getGlobalAngularAccel()const { ! if (!mData.enabled || !mData.solid) { return Vec3r(); *************** *** 86,90 **** Vec3r AccelerationSensor::getLocalLinearAccel()const { ! if (!mData.solid) { return Vec3r(); --- 86,90 ---- Vec3r AccelerationSensor::getLocalLinearAccel()const { ! if (!mData.enabled || !mData.solid) { return Vec3r(); *************** *** 97,101 **** Vec3r AccelerationSensor::getLocalAngularAccel()const { ! if (!mData.solid) { return Vec3r(); --- 97,101 ---- Vec3r AccelerationSensor::getLocalAngularAccel()const { ! if (!mData.enabled || !mData.solid) { return Vec3r(); Index: opal.h =================================================================== RCS file: /cvsroot/opal/opal/src/opal.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** opal.h 23 Mar 2005 07:54:34 -0000 1.25 --- opal.h 29 Mar 2005 03:05:46 -0000 1.26 *************** *** 56,59 **** --- 56,61 ---- #include "AccelerationSensor.h" #include "AccelerationSensorData.h" + #include "InclineSensor.h" + #include "InclineSensorData.h" #include "RaycastSensor.h" #include "RaycastSensorData.h" Index: SensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/SensorData.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SensorData.h 28 Mar 2005 22:33:07 -0000 1.10 --- SensorData.h 29 Mar 2005 03:05:46 -0000 1.11 *************** *** 37,42 **** { ACCELERATION_SENSOR, RAYCAST_SENSOR, - VELOCITY_SENSOR, VOLUME_SENSOR }; --- 37,42 ---- { ACCELERATION_SENSOR, + INCLINE_SENSOR, RAYCAST_SENSOR, VOLUME_SENSOR }; Index: Blueprint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Blueprint.cpp 28 Mar 2005 22:33:07 -0000 1.20 --- Blueprint.cpp 29 Mar 2005 03:05:46 -0000 1.21 *************** *** 37,40 **** --- 37,41 ---- #include "SensorData.h" #include "AccelerationSensorData.h" + #include "InclineSensorData.h" #include "RaycastSensorData.h" #include "VolumeSensorData.h" Index: Vec3r.h =================================================================== RCS file: /cvsroot/opal/opal/src/Vec3r.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Vec3r.h 7 Feb 2005 02:08:22 -0000 1.12 --- Vec3r.h 29 Mar 2005 03:05:46 -0000 1.13 *************** *** 43,52 **** inline real dot(const Vec3r & u, const Vec3r & v); inline Vec3r cross(const Vec3r & u, const Vec3r& v); ! inline Vec3r project(const Vec3r& from, const Vec3r& onto); inline real angleBetween(const Vec3r& u, const Vec3r& v); ! // u and v are already normalized inline real angleBetweenPreNorm(const Vec3r& u, const Vec3r& v); class Vec3r { --- 43,65 ---- inline real dot(const Vec3r & u, const Vec3r & v); inline Vec3r cross(const Vec3r & u, const Vec3r& v); ! ! /// Returns the projection of 'v' onto 'u'. ! inline Vec3r project(const Vec3r& u, const Vec3r& v); ! ! /// Given that the vector 'u' is already a unit vector, returns the ! /// projection of v onto u. ! inline Vec3r projectPreNorm(const Vec3r& u, const Vec3r& v); ! ! /// Returns a positive angle between 0 and 180 degrees. inline real angleBetween(const Vec3r& u, const Vec3r& v); ! /// Given that the vectors 'u' and 'v' are already normalized, returns ! /// a positive angle between 0 and 180 degrees. inline real angleBetweenPreNorm(const Vec3r& u, const Vec3r& v); + /// Returns true if the two vectors are roughly collinear (within some + /// epsilon). + inline bool areCollinear(const Vec3r& u, const Vec3r& v); + class Vec3r { *************** *** 241,247 **** } ! inline Vec3r project(const Vec3r& from, const Vec3r& onto) { ! return (dot(onto, from) / dot(onto, onto)) * onto; } --- 254,267 ---- } ! inline Vec3r project(const Vec3r& u, const Vec3r& v) { ! Vec3r u2 = u; ! u2.normalize(); ! return projectPreNorm(u2, v); ! } ! ! inline Vec3r projectPreNorm(const Vec3r& u, const Vec3r& v) ! { ! return dot(u, v) * u; } *************** *** 255,265 **** } - // returns a positive angle between 0 and 180 inline real angleBetweenPreNorm(const Vec3r& u, const Vec3r& v) { real val = dot(u, v); ! // clamp to avoid rounding errors; acos will puke with values outside ! // this range if (val < -1) { --- 275,284 ---- } inline real angleBetweenPreNorm(const Vec3r& u, const Vec3r& v) { real val = dot(u, v); ! // Clamp to avoid rounding errors; acos will puke with values outside ! // this range. if (val < -1) { *************** *** 273,276 **** --- 292,307 ---- return radToDeg(acos(val)); } + + inline bool areCollinear(const Vec3r& u, const Vec3r& v) + { + if (dot(u, v) < globals::OPAL_EPSILON) + { + return true; + } + else + { + return false; + } + } } Index: RaycastSensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/RaycastSensorData.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RaycastSensorData.h 28 Mar 2005 22:33:07 -0000 1.6 --- RaycastSensorData.h 29 Mar 2005 03:05:46 -0000 1.7 *************** *** 68,71 **** --- 68,72 ---- transform = data.transform; ray = data.ray; + contactGroup = data.contactGroup; } Index: SConscript =================================================================== RCS file: /cvsroot/opal/opal/src/SConscript,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** SConscript 23 Mar 2005 07:54:34 -0000 1.18 --- SConscript 29 Mar 2005 03:05:46 -0000 1.19 *************** *** 18,21 **** --- 18,23 ---- GearedMotor.h GearedMotorData.h + InclineSensor.h + InclineSensorData.h Joint.h JointBreakEventHandler.h *************** *** 65,68 **** --- 67,71 ---- CollisionEventHandler.cpp GearedMotor.cpp + InclineSensor.cpp Joint.cpp Logger.cpp --- NEW FILE: InclineSensor.h --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of EITHER: * * (1) The GNU Lesser General Public License as published by the Free * * Software Foundation; either version 2.1 of the License, or (at * * your option) any later version. The text of the GNU Lesser * * General Public License is included with this library in the * * file license-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * * license-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #ifndef OPAL_INCLINE_SENSOR_H #define OPAL_INCLINE_SENSOR_H #include "Defines.h" #include "Sensor.h" #include "InclineSensorData.h" namespace opal { class Simulator; /// A Sensor that measures a Solid's "tilt." This is similar to a real /// inclinometer that monitors how an object is oriented with respect /// to gravity. This Sensor takes a rotation axis (defined relative to /// the attached Solid's transform) and returns an angle describing how /// far the Solid has rotated around that axis. The rotation of the /// Solid is defined as zero degrees when the Sensor is initialized or /// when the rotation axis is redefined. This Sensor does /// nothing if it is not attached to a Solid (i.e. its returned values /// are always zero). class InclineSensor : public Sensor { public: InclineSensor(); virtual ~InclineSensor(); /// Initializes the Sensor with the given data structure. This will /// define the rotation angle as zero degrees when called. The Solid /// pointer should always be valid because this Sensor only works /// when attached to something. virtual void OPAL_CALL init(const InclineSensorData& data); /// Returns all data describing the Sensor. virtual const InclineSensorData& OPAL_CALL getData()const; /// Returns the angle of rotation about the local rotation axis /// relative to the initial angle of rotation. virtual real OPAL_CALL getAngle(); virtual void OPAL_CALL setEnabled(bool e); virtual bool OPAL_CALL isEnabled()const; /// Sets the local rotation axis around which the angle of rotation /// will be measured. This will redefine the rotation angle as zero /// degrees when called. virtual void OPAL_CALL setAxis(const Vec3r& axis); /// Returns the local rotation axis. virtual const Vec3r& OPAL_CALL getAxis(); virtual SensorType OPAL_CALL getType()const; virtual void OPAL_CALL setName(const std::string& name); virtual const std::string& OPAL_CALL getName()const; virtual void OPAL_CALL internal_update(); virtual bool OPAL_CALL internal_dependsOnSolid(Solid* s); protected: /// Stores data describing the Sensor. InclineSensorData mData; private: }; } #endif --- NEW FILE: InclineSensor.cpp --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of EITHER: * * (1) The GNU Lesser General Public License as published by the Free * * Software Foundation; either version 2.1 of the License, or (at * * your option) any later version. The text of the GNU Lesser * * General Public License is included with this library in the * * file license-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * * license-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #include "InclineSensor.h" #include "Simulator.h" namespace opal { InclineSensor::InclineSensor() { // "mData" is initialized in its own constructor. } InclineSensor::~InclineSensor() { } void InclineSensor::init(const InclineSensorData& data) { Sensor::init(); mData = data; } const InclineSensorData& InclineSensor::getData()const { return mData; } real InclineSensor::getAngle() { if (!mData.enabled || !mData.solid) { return 0; } //TODO: calc angle return 0; // temp } void InclineSensor::setEnabled(bool e) { if (!mInitCalled) { return; } mData.enabled = e; } bool InclineSensor::isEnabled()const { return mData.enabled; } void InclineSensor::setAxis(const Vec3r& axis) { //TODO: redefine angle as zero degrees mData.axis = axis; } const Vec3r& InclineSensor::getAxis() { return mData.axis; } SensorType InclineSensor::getType()const { return mData.getType(); } void InclineSensor::setName(const std::string& name) { mData.name = name; } const std::string& InclineSensor::getName()const { return mData.name; } void InclineSensor::internal_update() { if (mData.enabled) { // Do nothing. } } bool InclineSensor::internal_dependsOnSolid(Solid* s) { if (s == mData.solid) { return true; } else { return false; } } } Index: Solid.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Solid.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Solid.cpp 23 Mar 2005 07:54:34 -0000 1.30 --- Solid.cpp 29 Mar 2005 03:05:46 -0000 1.31 *************** *** 175,179 **** { if (mData.enabled && !mData.isStatic && ! f.vec.lengthSquared() > 0.0000001f ) { mForceList.push_back(f); --- 175,179 ---- { if (mData.enabled && !mData.isStatic && ! f.vec.lengthSquared() > globals::OPAL_EPSILON ) { mForceList.push_back(f); Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** BlueprintManager.cpp 28 Mar 2005 22:33:07 -0000 1.38 --- BlueprintManager.cpp 29 Mar 2005 03:05:46 -0000 1.39 *************** *** 39,42 **** --- 39,43 ---- #include "SensorData.h" #include "AccelerationSensorData.h" + #include "InclineSensorData.h" #include "RaycastSensorData.h" #include "VolumeSensorData.h" Index: OpalMath.h =================================================================== RCS file: /cvsroot/opal/opal/src/OpalMath.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** OpalMath.h 7 Feb 2005 02:08:22 -0000 1.8 --- OpalMath.h 29 Mar 2005 03:05:46 -0000 1.9 *************** *** 37,43 **** namespace globals { ! const real OPAL_PI=(real)3.14159265358979323846; ! const real OPAL_HALF_PI=(real)1.57079632679489661923; ! const real OPAL_ONE_THIRD=(real)0.33333333333333333333; } --- 37,44 ---- namespace globals { ! const real OPAL_PI = (real)3.14159265358979323846; ! const real OPAL_HALF_PI = (real)1.57079632679489661923; ! const real OPAL_ONE_THIRD = (real)0.33333333333333333333; ! const real OPAL_EPSILON = (real)0.000001; } --- NEW FILE: InclineSensorData.h --- /************************************************************************* * * * Open Physics Abstraction Layer * * Copyright (C) 2004-2005 * * Alan Fischer ala...@gm... * * Andres Reinot an...@re... * * Tyler Streeter tyl...@gm... * * All rights reserved. * * Web: opal.sourceforge.net * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of EITHER: * * (1) The GNU Lesser General Public License as published by the Free * * Software Foundation; either version 2.1 of the License, or (at * * your option) any later version. The text of the GNU Lesser * * General Public License is included with this library in the * * file license-LGPL.txt. * * (2) The BSD-style license that is included with this library in * * the file license-BSD.txt. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * * license-LGPL.txt and license-BSD.txt for more details. * * * *************************************************************************/ #ifndef OPAL_INCLINE_SENSOR_DATA_H #define OPAL_INCLINE_SENSOR_DATA_H #include "Defines.h" #include "SensorData.h" namespace opal { /// A data structure describing an InclineSensor. class InclineSensorData : public SensorData { public: OPAL_DECL InclineSensorData() : SensorData() { mType = INCLINE_SENSOR; // "axis" is initialized in its own constructor. } /// Copy constructor. OPAL_DECL InclineSensorData(const InclineSensorData& data) { (*this) = data; } OPAL_DECL virtual ~InclineSensorData() { } /// Makes a deep copy. OPAL_DECL virtual void OPAL_CALL operator=( const InclineSensorData& data) { mType = data.mType; enabled = data.enabled; name = data.name; solid = data.solid; internal_solidIndex = data.internal_solidIndex; solidBlueprintRefName = data.solidBlueprintRefName; transform = data.transform; axis = data.axis; } /// The local rotation axis around which the angle of rotation will /// be measured. Vec3r axis; protected: private: }; } #endif Index: Simulator.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Simulator.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** Simulator.cpp 25 Mar 2005 02:44:19 -0000 1.52 --- Simulator.cpp 29 Mar 2005 03:05:46 -0000 1.53 *************** *** 37,42 **** #include "AttractorMotor.h" #include "SpringMotor.h" - #include "RaycastSensor.h" #include "AccelerationSensor.h" #include "VolumeSensor.h" #include "PostStepEventHandler.h" --- 37,43 ---- #include "AttractorMotor.h" #include "SpringMotor.h" #include "AccelerationSensor.h" + #include "InclineSensor.h" + #include "RaycastSensor.h" #include "VolumeSensor.h" #include "PostStepEventHandler.h" Index: Matrix44r.h =================================================================== RCS file: /cvsroot/opal/opal/src/Matrix44r.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Matrix44r.h 14 Mar 2005 01:20:52 -0000 1.29 --- Matrix44r.h 29 Mar 2005 03:05:46 -0000 1.30 *************** *** 267,271 **** real trace = (*this)(0,0) + (*this)(1,1) + (*this)(2,2) + 1.0f; ! if(trace > 0.00000001) { real s = 0.5f / sqrt(trace); --- 267,271 ---- real trace = (*this)(0,0) + (*this)(1,1) + (*this)(2,2) + 1.0f; ! if(trace > globals::OPAL_EPSILON) { real s = 0.5f / sqrt(trace); *************** *** 514,518 **** fastInverse for affine transforms" << std::endl; real det = src.determinant(); ! if(abs(det < 0.000001)) return false; dest = ((real)1.0 / det) * src; return true; --- 514,518 ---- fastInverse for affine transforms" << std::endl; real det = src.determinant(); ! if(abs(det < globals::OPAL_EPSILON)) return false; dest = ((real)1.0 / det) * src; return true; *************** *** 523,527 **** inline void fastInverse(Matrix44r & result, const Matrix44r & source) { - static const real eps = (real)0.00000001; // source: stolen straight from GMTL // in case &dest is == &source... :( --- 523,526 ---- *************** *** 544,550 **** // TODO: write opal::abs. ! if(fabs(l0) > eps) l0 = 1.0f / l0; ! if(fabs(l1) > eps) l1 = 1.0f / l1; ! if(fabs(l2) > eps) l2 = 1.0f / l2; // apply the inverse scale to the 3x3 --- 543,549 ---- // TODO: write opal::abs. ! if(fabs(l0) > globals::OPAL_EPSILON) l0 = 1.0f / l0; ! if(fabs(l1) > globals::OPAL_EPSILON) l1 = 1.0f / l1; ! if(fabs(l2) > globals::OPAL_EPSILON) l2 = 1.0f / l2; // apply the inverse scale to the 3x3 *************** *** 571,575 **** // invert scale. ! const real tw = (fabs(src(3, 3)) > eps) ? 1.0f / src(3, 3) : 0.0f; // handle uniform scale in Nx4 matrices --- 570,575 ---- // invert scale. ! const real tw = (fabs(src(3, 3)) > globals::OPAL_EPSILON) ! ? 1.0f / src(3, 3) : 0.0f; // handle uniform scale in Nx4 matrices |
|
From: tylerstreeter <tyl...@us...> - 2005-03-29 03:05:56
|
Update of /cvsroot/opal/opal/vc7 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28949/vc7 Modified Files: opal-ode.vcproj Log Message: added some Vec3r functions; added InclineSensor Index: opal-ode.vcproj =================================================================== RCS file: /cvsroot/opal/opal/vc7/opal-ode.vcproj,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** opal-ode.vcproj 23 Mar 2005 07:54:35 -0000 1.21 --- opal-ode.vcproj 29 Mar 2005 03:05:48 -0000 1.22 *************** *** 137,140 **** --- 137,143 ---- </File> <File + RelativePath="..\src\InclineSensor.cpp"> + </File> + <File RelativePath="..\src\Joint.cpp"> </File> *************** *** 219,222 **** --- 222,231 ---- </File> <File + RelativePath="..\src\InclineSensor.h"> + </File> + <File + RelativePath="..\src\InclineSensorData.h"> + </File> + <File RelativePath="..\src\Joint.h"> </File> |
|
From: tylerstreeter <tyl...@us...> - 2005-03-29 03:05:56
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28949 Modified Files: todo.txt Log Message: added some Vec3r functions; added InclineSensor Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** todo.txt 28 Mar 2005 22:33:08 -0000 1.62 --- todo.txt 29 Mar 2005 03:05:47 -0000 1.63 *************** *** 6,13 **** --- 6,24 ---- - add example to sensors tutorial + * search for TODOs in InclineSensor + + * Things to do for InclineSensor: + - parse from xml + - add to xml example + - add to instantiateBlueprint + - add to Blueprint finalize function + - add to Blueprint addSensor/addMotor function + * add license notice to samples' source files * clean up samples + * comment math functions + For Version 0.4.0 ================= |
|
From: tylerstreeter <tyl...@us...> - 2005-03-29 03:05:56
|
Update of /cvsroot/opal/opal/src/ODE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28949/src/ODE Modified Files: ODESimulator.h Log Message: added some Vec3r functions; added InclineSensor Index: ODESimulator.h =================================================================== RCS file: /cvsroot/opal/opal/src/ODE/ODESimulator.h,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ODESimulator.h 25 Mar 2005 02:44:21 -0000 1.68 --- ODESimulator.h 29 Mar 2005 03:05:47 -0000 1.69 *************** *** 33,36 **** --- 33,37 ---- #include "../Simulator.h" #include "../AccelerationSensor.h" + #include "../InclineSensor.h" #include "../RaycastSensor.h" #include "../VolumeSensor.h" |
|
From: tylerstreeter <tyl...@us...> - 2005-03-28 22:34:16
|
Update of /cvsroot/opal/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5617 Modified Files: todo.txt tutorial9.html Log Message: added a tutorial on Blueprints and XML files Index: todo.txt =================================================================== RCS file: /cvsroot/opal/web/todo.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** todo.txt 28 Mar 2005 18:45:53 -0000 1.9 --- todo.txt 28 Mar 2005 22:33:54 -0000 1.10 *************** *** 2,26 **** ================= - * relate sensors to vestibular senses in sensors tutorial - * tutorials ! - move XML samples into xml tutorial; or maybe have a Blueprints page on the OPAL site; maybe remove example.xml and just describe every xml element/attribute somewhere) ! - describe trigger volumes in the contact groups tutorial ! - add diagrams ! - add more specific stuff; not just how to create things and call functions; show how to do common tasks (i.e. setup a car with motors on the front wheels); maybe just have a set of 'advanced' tutorials that combine things like this ! - read through everything to make sure it makes sense and is actually helpful ! ! * in contact group tutorial, mention that they are used for object-object physical contacts and ray and volume sensors ! ! * somewhere mention the difference between a VolumeSensor and a trigger Solid ! * notes for sensors ! - RaycastSensor (i.e. "PSD (position sensitive detector)" or "rangefinder"): measures distance from sensor to first intersection (attach to a solid [be sure to ignore collisions with the attached solid] or nothing) ! - not updated regularly; must be updated manually by user ! - VolumeSensor (i.e. "proximity sensor?"): similar to RaycastSensor, but for a volume; finds all Solids colliding with a given (attached) Solid ! - not updated regularly; must be updated manually by user ! - should this be combined with trigger solids? probably not: ProximitySensors are one-time, triggers are always updated (triggers are actually just solids with a ContactSensor and don't generate contact joints) ! - AccelerationSensor (i.e. "accelerometer"): linear and/or angular acceleration sensor ! - InclineSensor (i.e. "inclinometer"): measures angle between initial and current orientation * post api notes --- 2,9 ---- ================= * tutorials ! - relate sensors to vestibular senses in sensors tutorial ! * read through everything to make sure it makes sense and is actually helpful * post api notes Index: tutorial9.html =================================================================== RCS file: /cvsroot/opal/web/tutorial9.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tutorial9.html 26 Mar 2005 17:34:52 -0000 1.1 --- tutorial9.html 28 Mar 2005 22:34:07 -0000 1.2 *************** *** 25,45 **** <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>176</o:Revision> ! <o:TotalTime>375</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-26T17:28:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>621</o:Words> ! <o:Characters>3545</o:Characters> <o:Company>none</o:Company> ! <o:Lines>29</o:Lines> ! <o:Paragraphs>8</o:Paragraphs> ! <o:CharactersWithSpaces>4158</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>90</w:Zoom> ! <w:SpellingState>Clean</w:SpellingState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> --- 25,44 ---- <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>241</o:Revision> ! <o:TotalTime>508</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T22:27:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>1157</o:Words> ! <o:Characters>6599</o:Characters> <o:Company>none</o:Company> ! <o:Lines>54</o:Lines> ! <o:Paragraphs>15</o:Paragraphs> ! <o:CharactersWithSpaces>7741</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>75</w:Zoom> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> *************** *** 81,87 **** text-decoration:underline; text-underline:single;} - span.SpellE - {mso-style-name:""; - mso-spl-e:yes;} @page Section1 {size:8.5in 11.0in; --- 80,83 ---- *************** *** 92,95 **** --- 88,163 ---- div.Section1 {page:Section1;} + /* List Definitions */ + @list l0 + {mso-list-id:880628336; + mso-list-template-ids:-1775226150;} + @list l0:level1 + {mso-level-number-format:bullet; + mso-level-text:o; + mso-level-tab-stop:.5in; + mso-level-number-position:left; + text-indent:-.25in; + mso-ansi-font-size:10.0pt; + font-family:"Courier New"; + mso-bidi-font-family:"Times New Roman";} + @list l1 + {mso-list-id:1412464396; + mso-list-template-ids:2009647496;} + @list l1:level1 + {mso-level-number-format:bullet; + mso-level-text:o; + mso-level-tab-stop:.5in; + mso-level-number-position:left; + text-indent:-.25in; + mso-ansi-font-size:10.0pt; + font-family:"Courier New"; + mso-bidi-font-family:"Times New Roman";} + @list l2 + {mso-list-id:1974284744; + mso-list-type:hybrid; + mso-list-template-ids:26922882 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} + @list l2:level1 + {mso-level-number-format:bullet; + mso-level-text:o; + mso-level-tab-stop:.5in; + mso-level-number-position:left; + text-indent:-.25in; + font-family:"Courier New";} + @list l2:level2 + {mso-level-tab-stop:1.0in; + mso-level-number-position:left; + text-indent:-.25in;} + @list l2:level3 + {mso-level-tab-stop:1.5in; + mso-level-number-position:left; + text-indent:-.25in;} + @list l2:level4 + {mso-level-tab-stop:2.0in; + mso-level-number-position:left; + text-indent:-.25in;} + @list l2:level5 + {mso-level-tab-stop:2.5in; + mso-level-number-position:left; + text-indent:-.25in;} + @list l2:level6 + {mso-level-tab-stop:3.0in; + mso-level-number-position:left; + text-indent:-.25in;} + @list l2:level7 + {mso-level-tab-stop:3.5in; + mso-level-number-position:left; + text-indent:-.25in;} + @list l2:level8 + {mso-level-tab-stop:4.0in; + mso-level-number-position:left; + text-indent:-.25in;} + @list l2:level9 + {mso-level-tab-stop:4.5in; + mso-level-number-position:left; + text-indent:-.25in;} + ol + {margin-bottom:0in;} + ul + {margin-bottom:0in;} --> </style> *************** *** 111,115 **** </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="64514"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> --- 179,183 ---- </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="66562"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> *************** *** 146,191 **** <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-family:"Book Antiqua";color:black'>Note:</span></b><span ! style='font-family:"Book Antiqua";color:black'> See a list of example OPAL XML ! files at the end of this page.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; ! color:black'>asdfkasjdnlkasjdnf;lkasdnf</span></span><span style='font-family: ! "Book Antiqua";color:black'><o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; ! color:black'>asdf;klnsad;lknsd</span></span><span style='font-family:"Book Antiqua"; ! color:black'><o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; ! color:black'>asd;flksandf</span></span><span style='font-family:"Book Antiqua"; ! color:black'>;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Example OPAL ! XML <span class=SpellE>Files</span><o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><a - href="files/example.xml"><span class=SpellE>example.xml</span></a>: Contains examples - of every object type and parameter.<span style='mso-spacerun:yes'> - </span>This is to be used as a reference that shows all the available elements - and attributes.<span style='mso-spacerun:yes'> </span>It is a valid file - that OPAL can load, but it isnt very useful to instantiate.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><a - href="files/ragdoll.xml"><span class=SpellE>ragdoll.xml</span></a>: Contains a - <span class=SpellE>ragdoll</span> Blueprint of medium complexity.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Sensors - acquire information from a simulation.<span style='mso-spacerun:yes'> - </span>There are several types of Sensors, including Acceleration Sensors, <span - class=SpellE>Raycast</span> Sensors, and Volume Sensors.<span - style='mso-spacerun:yes'> </span>This tutorial will show how to setup each - type.<span style='mso-spacerun:yes'> </span>It will also give examples of - how each type could be used.<span style='mso-spacerun:yes'> </span>Keep in - mind that a Sensor can either be attached to a Solid or just positioned - somewhere in the environment.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Lets ! first create all the objects well need (and assume they will be initialized ! elsewhere):<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 214,365 ---- <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-family:"Book Antiqua";color:black'>Note:</span></b><span ! style='font-family:"Book Antiqua";color:black'> See a list of example OPAL ! XML files at the end of this page.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>This tutorial ! covers Blueprints and OPAL XML files, two features that are useful when ! dealing with complex physical objects containing several different components ! (e.g. vehicles, ragdolls, game levels, etc.)<span style='mso-spacerun:yes'> ! </span>Blueprints are collections of data objects that describe Solids, ! Joints, Motors, and Sensors.<span style='mso-spacerun:yes'> </span>They can ! be setup by manually creating data objects and adding them to the Blueprint, ! by copying data from existing Solids, Joints, etc., or by loading them from ! OPAL XML files.<span style='mso-spacerun:yes'> </span>Objects that refer to ! others (e.g. a Joint refers to two Solids) can only refer to objects within ! the same Blueprint.<span style='mso-spacerun:yes'> </span>Instantiating a ! Blueprint returns a BlueprintInstance object that contains pointers to all ! the instantiated objects within the Blueprint; this will be described towards ! the end of the tutorial.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Creating ! Blueprints Manually<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! first example here shows how to create a Blueprint totally from scratch and ! instantiate it:<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left ! style='background:silver;border-collapse:collapse;border:none;mso-border-alt: ! solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: ! 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: ! page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> ! <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> ! <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; ! mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; ! height:22.95pt'> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Create ! a SolidData object.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::SolidData ! solid1Data;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1Data.name ! = object1;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::BoxShapeData ! boxData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1Data.addShape(boxData);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Create ! another SolidData object.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::SolidData ! solid2Data;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid2Data.name ! = object2;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid2Data.translate(0.0, ! 1.5, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::CapsuleShapeData ! capsuleData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid2Data.addShape(capsuleData);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Create ! a JointData object.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::JointData ! jointData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.setType(opal::HINGE_JOINT);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid0BlueprintRefName ! = solid0;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid1BlueprintRefName ! = solid1;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.anchor ! = opal::Point3r(0.0, 0.75, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.axis[0].direction ! = opal::Vec3r(1.0, 0.0, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Setup a ! Blueprint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Blueprint ! bp;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.addSolid(&solid1Data);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.addSolid(&solid2Data);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.addJoint(jointData);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.finalize();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// ! Instantiate the Blueprint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::BlueprintInstance ! instance;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->instantiateBlueprint(instance, ! bp);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! </td> ! </tr> ! </table> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Instantiating ! the Blueprint will create instances of all the objects contained in the ! Blueprint.<span style='mso-spacerun:yes'> </span>The call to finalize is ! necessary to let the Blueprint setup internal indices used for references to ! objects within the Blueprint.<span style='mso-spacerun:yes'> </span>The ! Blueprint cannot be modified after calling finalize.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Note ! the use of object names here.<span style='mso-spacerun:yes'> </span>All ! references to objects within a Blueprint must use string names.<span ! style='mso-spacerun:yes'> </span>If the JointData object here contained ! invalid strings for the Solid names, the Joint could not be instantiated ! later.<span style='mso-spacerun:yes'> </span>All string names for a certain ! type of object must be unique within a given Blueprint.<span ! style='mso-spacerun:yes'> </span>The Blueprint ignores pointer references; ! for example, the JointData object contains two Solid pointers, but the ! Blueprint ignores these and only uses the solid0BlueprintRefName and solid0BlueprintRefName ! strings.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! second example shows how to create a Blueprint by cloning existing objects:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 199,209 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Simulator</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>sim</span> = <span class=SpellE>opal::createSimulator</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* solid = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 373,429 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! solid1 = sim->createSolid();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! solid2 = sim->createSolid();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! joint = sim->createJoint();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Get a ! SolidData object from an existing Solid.<span style='mso-spacerun:yes'> ! </span>It is assumed that the <o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Solids ! name has been set via Solid::setName.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::SolidData ! solid1Data = solid1->getData();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Get a ! SolidData object from another existing Solid.<span ! style='mso-spacerun:yes'> </span>It is assumed that <o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// the Solids ! name has been set via Solid::setName.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::SolidData ! solid2Data = solid2->getData();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Get a ! JointData object from an existing Joint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::JointData ! jointData = joint->getData();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Setup a ! Blueprint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Blueprint ! bp;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.addSolid(&solid1Data);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.addSolid(&solid2Data);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.addJoint(jointData);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>bp.finalize();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// ! Instantiate the Blueprint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::BlueprintInstance ! instance1, instance2;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->instantiateBlueprint(instance1, ! bp);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Matrix44r ! offset;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>offset.translate(5, ! 0, 0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->instantiateBlueprint(instance2, ! bp, offset);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 211,223 **** </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Acceleration ! Sensor<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! first Sensor we will use here is an Acceleration Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 431,489 ---- </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Besides + the use of existing data objects, this example contained a notable difference + from the previous one: it instantiated the Blueprint twice, each time at a + different location.<span style='mso-spacerun:yes'> </span>The instantiateBlueprint + function takes an offset matrix (and a real value for scaling, not shown + here) that can affect everything in the Blueprint instance at once.<o:p></o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Loading Blueprints ! from OPAL XML Files<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>OPAL ! XML files can be used to describe all parameters for Solids, Joints, Motors, ! and Sensors.<span style='mso-spacerun:yes'> </span>Each file can contain a ! single Blueprint.<span style='mso-spacerun:yes'> </span>Rather than describe ! the complete specification for these XML files, this tutorial contains an ! example that shows every possible XML element and attribute in the OPAL XML ! files (see the example.xml file in the section below).<span ! style='mso-spacerun:yes'> </span>Most XML elements are optional; the only ! required elements are objects types and string references to other objects ! (e.g. a Joints references to two Solids).<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Here ! we load a Blueprint from a file and instantiate it:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 231,259 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::AccelerationSensorData</span></span><span ! style='font-family:Courier;color:black'> data;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.solid</span></span><span style='font-family:Courier; ! color:black'> = solid;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.transform.translate</span></span><span style='font-family: ! Courier;color:black'>(4, 0, -1);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::AccelerationSensor</span></span><span style='font-family: ! Courier;color:black'>* <span class=SpellE>accelSensor</span> = <span ! class=SpellE>sim</span>-><span class=SpellE>createAccelerationSensor</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>accelSensor</span></span><span style='font-family:Courier; ! color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Vec3r ! <span class=SpellE>accel</span> = <span class=SpellE>accelSensor</span>-></span><span ! class=SpellE><span style='font-size:10.0pt;font-family:"Courier New"; ! color:windowtext'>getGlobalLinearAccel</span></span><span style='font-size: ! 10.0pt;font-family:"Courier New";color:windowtext'>();</span><span ! style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 497,516 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Blueprint ! sailboatBP;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Load ! the Blueprint from a file.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::loadFile(sailboatBP, ! sailboat.xml);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// ! Instantiate the Blueprint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::BlueprintInstance ! instance;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->instantiateBlueprint(instance, ! sailboatBP);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 261,265 **** </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 518,521 ---- *************** *** 271,285 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! Sensor is automatically attached to the Solid if its Solid pointer is ! set.<span style='mso-spacerun:yes'> </span>It calculates the linear and angular ! acceleration of the attached Solid at the point of the Sensor (which can be ! offset from the Solid by using the Sensors transform).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Raycast ! Sensor<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! next Sensor is the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 527,550 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>If a ! Blueprint loaded from a file is to be instantiated multiple times, it is wise ! to keep the Blueprint around until you are done with it to keep from loading ! the file multiple times.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Getting ! Access to Instantiated Object Pointers<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Once a ! Blueprint is instantiated, you may want to get pointers to all the individual ! objects that were just created.<span style='mso-spacerun:yes'> </span>There ! are two ways to do this: getting a pointer by name and looping over the ! pointers.<span style='mso-spacerun:yes'> </span>The following examples ! demonstrate these methods.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Here ! we will load a Blueprint from a file, instantiate it, and get pointers to ! specific objects by name (note that the objects must have been given names in ! order to find them after instantiation):<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 293,335 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::RaycastSensorData</span></span><span style='font-family: ! Courier;color:black'> data;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.solid</span></span><span style='font-family:Courier; ! color:black'> = solid;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.ray.setOrigin</span></span><span style='font-family:Courier; ! color:black'>(opal::Point3r(0, 0, 0));<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.ray.setDir</span></span><span style='font-family:Courier; ! color:black'>(opal::Vec3r(0, 0, -1));<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.contactGroup</span></span><span style='font-family:Courier; ! color:black'> = 2;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::RaycastSensor</span></span><span style='font-family: ! Courier;color:black'>* <span class=SpellE>raySensor</span> = <span ! class=SpellE>sim</span>-><span class=SpellE>createRaycastSensor</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>raySensor</span></span><span style='font-family:Courier; ! color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::RaycastResult</span></span><span style='font-family: ! Courier;color:black'> result = <span class=SpellE>raySensor</span>-></span><span ! class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; ! color:windowtext'>fireRay</span></span><span style='font-family:Courier; ! mso-bidi-font-family:"Courier New";color:windowtext'>();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>opal::Point3r <span class=SpellE>hitPoint</span> ! = <span class=SpellE>result.intersection</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! mso-bidi-font-family:"Courier New";color:windowtext'>opal::Solid</span></span><span ! style='font-family:Courier;mso-bidi-font-family:"Courier New";color:windowtext'>* ! <span class=SpellE>hitSolid</span> = <span class=SpellE>result.solid</span>;</span><span ! style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 558,584 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Blueprint ! sailboatBP;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Load ! the Blueprint from a file.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::loadFile(sailboatBP, ! sailboat.xml);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// ! Instantiate the Blueprint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::BlueprintInstance ! instance;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->instantiateBlueprint(instance, ! sailboatBP);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! hullSolid = instance.getSolid(hull);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! mastSolid = instance.getSolid(mast);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::ThrusterMotor* ! engine = instance.getMotor(main engine);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 337,341 **** </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 586,589 ---- *************** *** 351,370 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; ! color:black'>Raycast</span></span><span style='font-family:"Book Antiqua"; ! color:black'> Sensors must be fired manually they do not update anything ! every time step.<span style='mso-spacerun:yes'> </span>When they are fired, they ! cast a ray into the environment and return data describing the closest point ! of intersection (if any) from the rays origin.<span ! style='mso-spacerun:yes'> </span>The <span class=SpellE>Raycast</span> ! Sensor uses a contact group to limit which objects it collides with.<span ! style='mso-spacerun:yes'> </span>(See other tutorials for more information on ! contact groups.)<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><span ! style='mso-spacerun:yes'> </span><o:p></o:p></span></p> ! <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Volume Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! Volume Sensor is similar to the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 599,606 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! next example loops through every Solid in the instance, creating and storing an ! application-specific object for each:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 378,448 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::VolumeSensorData</span></span><span style='font-family: ! Courier;color:black'> data;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.contactGroup</span></span><span style='font-family:Courier; ! color:black'> = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal:: <span ! class=SpellE>VolumeSensor</span>* <span class=SpellE>volSensor</span> = <span ! class=SpellE>sim</span>-><span class=SpellE>createVolumeSensor</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>volSensor</span></span><span style='font-family:Courier; ! color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Define ! a volume Solid.<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* volume = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::SphereShapeData</span></span><span style='font-family: ! Courier;color:black'> <span class=SpellE>sphereData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sphereData.radius</span></span><span style='font-family:Courier; ! color:black'> = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>volume-><span ! class=SpellE>addShape</span>(<span class=SpellE>sphereData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::VolumeQueryResult</span></span><span style='font-family: ! Courier;color:black'> result = <span class=SpellE>volSensor</span>-></span><span ! class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; ! color:windowtext'>queryVolume</span></span><span style='font-family:Courier; ! mso-bidi-font-family:"Courier New";color:windowtext'>(volume);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>for (<span class=SpellE>int</span> <span ! class=SpellE>i</span>=0; <span class=SpellE>i</span><<span class=SpellE>result.getNumSolids</span>(); ! ++<span class=SpellE>i</span>)<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>{<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>opal::Solid</span>* s = <span class=SpellE>result.getSolid</span>(<span ! class=SpellE>i</span>);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>opal::Force</span> f;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.type</span> = <span class=SpellE>opal::GLOBAL_FORCE</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.duration</span> = (<span class=SpellE>opal::real</span>)0.05;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.vec</span> = s-><span class=SpellE>getPosition</span>() ! volume-><span class=SpellE>getPosition</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.vec</span> *= 100;<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>s-><span class=SpellE>addForce</span>(f);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>}<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 614,648 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Blueprint ! sailboatBP;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Load ! the Blueprint from a file.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::loadFile(sailboatBP, ! sailboat.xml);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// ! Instantiate the Blueprint.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::BlueprintInstance ! instance;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->instantiateBlueprint(instance, ! sailboatBP);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>for (int ! i=0; i<instance.getNumSolids(); ++i)<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>{<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><span ! style='mso-spacerun:yes'> </span>opal::Solid* solid = ! instance.getSolid(i);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><span ! style='mso-spacerun:yes'> </span>PhysicalPart* newPart = new ! PhysicalPart();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><span ! style='mso-spacerun:yes'> </span>newPart->setOPALSolid(solid);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><span ! style='mso-spacerun:yes'> </span>AppSceneManager::addPart(newPart);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>}<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 450,456 **** </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 650,653 ---- *************** *** 471,489 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Volume ! Sensors take a volume Solid and query the environment for Solids that ! collide with the volume Solid.<span style='mso-sp... [truncated message content] |
|
From: tylerstreeter <tyl...@us...> - 2005-03-28 22:33:18
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4923/src Modified Files: AccelerationSensorData.h AttractorMotorData.h Blueprint.cpp BlueprintManager.cpp GearedMotorData.h JointData.h RaycastSensorData.h SensorData.h ServoMotorData.h SpringMotorData.h ThrusterMotorData.h VolumeSensorData.h Log Message: renamed an "internal_" variable to make it not internal; specifically, renamed the reference string names used within Blueprints; these should be usable by the users, so they shouldn't be named "internal_" Index: SensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/SensorData.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** SensorData.h 23 Mar 2005 20:24:47 -0000 1.9 --- SensorData.h 28 Mar 2005 22:33:07 -0000 1.10 *************** *** 55,59 **** solid = NULL; internal_solidIndex = 0; ! internal_solidName = ""; // "transform" is initialized in its own constructor. } --- 55,59 ---- solid = NULL; internal_solidIndex = 0; ! solidBlueprintRefName = ""; // "transform" is initialized in its own constructor. } *************** *** 83,88 **** int internal_solidIndex; ! /// Internal data used for Blueprint instantiation. ! std::string internal_solidName; /// If the Sensor is attached to a Solid, this transform is the global --- 83,88 ---- int internal_solidIndex; ! /// String used for for intra-Blueprint references. ! std::string solidBlueprintRefName; /// If the Sensor is attached to a Solid, this transform is the global Index: Blueprint.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Blueprint.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Blueprint.cpp 23 Mar 2005 07:54:33 -0000 1.19 --- Blueprint.cpp 28 Mar 2005 22:33:07 -0000 1.20 *************** *** 83,88 **** // Find the indices of the references. ! int solid0Index = getSolidIndex(data->internal_solid0Name); ! int solid1Index = getSolidIndex(data->internal_solid1Name); if (-1 == solid0Index || -1 == solid1Index) --- 83,88 ---- // Find the indices of the references. ! int solid0Index = getSolidIndex(data->solid0BlueprintRefName); ! int solid1Index = getSolidIndex(data->solid1BlueprintRefName); if (-1 == solid0Index || -1 == solid1Index) *************** *** 118,124 **** (AttractorMotorData*)mMotorList.at(i); int solid0Index = ! getSolidIndex(data->internal_solid0Name); int solid1Index = ! getSolidIndex(data->internal_solid1Name); if (-1 == solid0Index || -1 == solid1Index) { --- 118,124 ---- (AttractorMotorData*)mMotorList.at(i); int solid0Index = ! getSolidIndex(data->solid0BlueprintRefName); int solid1Index = ! getSolidIndex(data->solid1BlueprintRefName); if (-1 == solid0Index || -1 == solid1Index) { *************** *** 136,140 **** GearedMotorData* data = (GearedMotorData*)mMotorList.at(i); ! int jointIndex = getJointIndex(data->internal_jointName); if (-1 == jointIndex) { --- 136,140 ---- GearedMotorData* data = (GearedMotorData*)mMotorList.at(i); ! int jointIndex = getJointIndex(data->jointBlueprintRefName); if (-1 == jointIndex) { *************** *** 150,154 **** { ServoMotorData* data = (ServoMotorData*)mMotorList.at(i); ! int jointIndex = getJointIndex(data->internal_jointName); if (-1 == jointIndex) { --- 150,154 ---- { ServoMotorData* data = (ServoMotorData*)mMotorList.at(i); ! int jointIndex = getJointIndex(data->jointBlueprintRefName); if (-1 == jointIndex) { *************** *** 165,169 **** SpringMotorData* data = (SpringMotorData*)mMotorList.at(i); ! int solidIndex = getSolidIndex(data->internal_solidName); if (-1 == solidIndex) { --- 165,169 ---- SpringMotorData* data = (SpringMotorData*)mMotorList.at(i); ! int solidIndex = getSolidIndex(data->solidBlueprintRefName); if (-1 == solidIndex) { *************** *** 180,184 **** ThrusterMotorData* data = (ThrusterMotorData*)mMotorList.at(i); ! int solidIndex = getSolidIndex(data->internal_solidName); if (-1 == solidIndex) { --- 180,184 ---- ThrusterMotorData* data = (ThrusterMotorData*)mMotorList.at(i); ! int solidIndex = getSolidIndex(data->solidBlueprintRefName); if (-1 == solidIndex) { *************** *** 225,229 **** // the index is -1, the Sensor must not be attached to any // Solid. ! int solidIndex = getSolidIndex(data->internal_solidName); data->internal_solidIndex = solidIndex; } --- 225,229 ---- // the index is -1, the Sensor must not be attached to any // Solid. ! int solidIndex = getSolidIndex(data->solidBlueprintRefName); data->internal_solidIndex = solidIndex; } Index: AccelerationSensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/AccelerationSensorData.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AccelerationSensorData.h 14 Mar 2005 05:18:27 -0000 1.1 --- AccelerationSensorData.h 28 Mar 2005 22:33:07 -0000 1.2 *************** *** 63,67 **** solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! internal_solidName = data.internal_solidName; transform = data.transform; } --- 63,67 ---- solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! solidBlueprintRefName = data.solidBlueprintRefName; transform = data.transform; } Index: RaycastSensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/RaycastSensorData.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RaycastSensorData.h 25 Mar 2005 02:44:19 -0000 1.5 --- RaycastSensorData.h 28 Mar 2005 22:33:07 -0000 1.6 *************** *** 65,69 **** solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! internal_solidName = data.internal_solidName; transform = data.transform; ray = data.ray; --- 65,69 ---- solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! solidBlueprintRefName = data.solidBlueprintRefName; transform = data.transform; ray = data.ray; Index: GearedMotorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/GearedMotorData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GearedMotorData.h 11 Mar 2005 05:31:56 -0000 1.4 --- GearedMotorData.h 28 Mar 2005 22:33:07 -0000 1.5 *************** *** 44,48 **** joint = NULL; internal_jointIndex = 0; ! internal_jointName = ""; jointAxisNum = 0; maxTorque = defaults::motor::geared::maxTorque; --- 44,48 ---- joint = NULL; internal_jointIndex = 0; ! jointBlueprintRefName = ""; jointAxisNum = 0; maxTorque = defaults::motor::geared::maxTorque; *************** *** 70,74 **** joint = data.joint; internal_jointIndex = data.internal_jointIndex; ! internal_jointName = data.internal_jointName; jointAxisNum = data.jointAxisNum; maxTorque = data.maxTorque; --- 70,74 ---- joint = data.joint; internal_jointIndex = data.internal_jointIndex; ! jointBlueprintRefName = data.jointBlueprintRefName; jointAxisNum = data.jointAxisNum; maxTorque = data.maxTorque; *************** *** 83,88 **** int internal_jointIndex; ! /// Internal data used for Blueprint instantiation. ! std::string internal_jointName; /// The index of the specific Joint axis affected by this Motor. --- 83,88 ---- int internal_jointIndex; ! /// String used for for intra-Blueprint references. ! std::string jointBlueprintRefName; /// The index of the specific Joint axis affected by this Motor. Index: AttractorMotorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/AttractorMotorData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AttractorMotorData.h 11 Mar 2005 05:31:56 -0000 1.4 --- AttractorMotorData.h 28 Mar 2005 22:33:07 -0000 1.5 *************** *** 46,51 **** internal_solid0Index = 0; internal_solid1Index = 0; ! internal_solid0Name = ""; ! internal_solid1Name = ""; strength = defaults::motor::attractor::strength; exponent = defaults::motor::attractor::exponent; --- 46,51 ---- internal_solid0Index = 0; internal_solid1Index = 0; ! solid0BlueprintRefName = ""; ! solid1BlueprintRefName = ""; strength = defaults::motor::attractor::strength; exponent = defaults::motor::attractor::exponent; *************** *** 73,78 **** internal_solid0Index = data.internal_solid0Index; internal_solid1Index = data.internal_solid1Index; ! internal_solid0Name = data.internal_solid0Name; ! internal_solid1Name = data.internal_solid1Name; strength = data.strength; exponent = data.exponent; --- 73,78 ---- internal_solid0Index = data.internal_solid0Index; internal_solid1Index = data.internal_solid1Index; ! solid0BlueprintRefName = data.solid0BlueprintRefName; ! solid1BlueprintRefName = data.solid1BlueprintRefName; strength = data.strength; exponent = data.exponent; *************** *** 91,99 **** int internal_solid1Index; ! /// Internal data used for Blueprint instantiation. ! std::string internal_solid0Name; ! /// Internal data used for Blueprint instantiation. ! std::string internal_solid1Name; /// Constant used to scale attraction (repulsion if strength < 0). --- 91,99 ---- int internal_solid1Index; ! /// String used for for intra-Blueprint references. ! std::string solid0BlueprintRefName; ! /// String used for for intra-Blueprint references. ! std::string solid1BlueprintRefName; /// Constant used to scale attraction (repulsion if strength < 0). Index: BlueprintManager.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/BlueprintManager.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** BlueprintManager.cpp 25 Mar 2005 02:44:19 -0000 1.37 --- BlueprintManager.cpp 28 Mar 2005 22:33:07 -0000 1.38 *************** *** 389,395 **** { // Get the Solids' names. ! data->internal_solid0Name = getAttributeString(paramNodePtr, "solid0"); ! data->internal_solid1Name = getAttributeString(paramNodePtr, "solid1"); } --- 389,395 ---- { // Get the Solids' names. ! data->solid0BlueprintRefName = getAttributeString(paramNodePtr, "solid0"); ! data->solid1BlueprintRefName = getAttributeString(paramNodePtr, "solid1"); } *************** *** 735,741 **** { // Get the Solids' names. ! data->internal_solid0Name = getAttributeString(paramNodePtr, "solid0"); ! data->internal_solid1Name = getAttributeString(paramNodePtr, "solid1"); } --- 735,741 ---- { // Get the Solids' names. ! data->solid0BlueprintRefName = getAttributeString(paramNodePtr, "solid0"); ! data->solid1BlueprintRefName = getAttributeString(paramNodePtr, "solid1"); } *************** *** 815,819 **** { // Get the Joint's name. ! data->internal_jointName = getAttributeString(paramNodePtr, "joint"); } --- 815,819 ---- { // Get the Joint's name. ! data->jointBlueprintRefName = getAttributeString(paramNodePtr, "joint"); } *************** *** 926,930 **** { // Get the Joint's name. ! data->internal_jointName = getAttributeString(paramNodePtr, "joint"); } --- 926,930 ---- { // Get the Joint's name. ! data->jointBlueprintRefName = getAttributeString(paramNodePtr, "joint"); } *************** *** 1072,1076 **** { // Get the Solid's name. ! data->internal_solidName = getAttributeString(paramNodePtr, "solid"); } --- 1072,1076 ---- { // Get the Solid's name. ! data->solidBlueprintRefName = getAttributeString(paramNodePtr, "solid"); } *************** *** 1176,1180 **** { // Get the Solid's name. ! data->internal_solidName = getAttributeString(paramNodePtr, "solid"); } --- 1176,1180 ---- { // Get the Solid's name. ! data->solidBlueprintRefName = getAttributeString(paramNodePtr, "solid"); } *************** *** 1280,1289 **** { // Get the Solids' names. ! data->internal_solidName = getAttributeString(paramNodePtr, "solid"); } else { ! data->internal_solidName = ""; } #endif --- 1280,1289 ---- { // Get the Solids' names. ! data->solidBlueprintRefName = getAttributeString(paramNodePtr, "solid"); } else { ! data->solidBlueprintRefName = ""; } #endif Index: SpringMotorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/SpringMotorData.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SpringMotorData.h 23 Mar 2005 04:52:36 -0000 1.5 --- SpringMotorData.h 28 Mar 2005 22:33:07 -0000 1.6 *************** *** 58,62 **** solid = NULL; internal_solidIndex = 0; ! internal_solidName = ""; mode = LINEAR_MODE; // "attachOffset" is initialized in its own constructor. --- 58,62 ---- solid = NULL; internal_solidIndex = 0; ! solidBlueprintRefName = ""; mode = LINEAR_MODE; // "attachOffset" is initialized in its own constructor. *************** *** 90,94 **** solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! internal_solidName = data.internal_solidName; mode = data.mode; attachOffset = data.attachOffset; --- 90,94 ---- solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! solidBlueprintRefName = data.solidBlueprintRefName; mode = data.mode; attachOffset = data.attachOffset; *************** *** 109,114 **** int internal_solidIndex; ! /// Internal data used for Blueprint instantiation. ! std::string internal_solidName; /// The Motor's mode of operation. --- 109,114 ---- int internal_solidIndex; ! /// String used for for intra-Blueprint references. ! std::string solidBlueprintRefName; /// The Motor's mode of operation. Index: ThrusterMotorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/ThrusterMotorData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ThrusterMotorData.h 11 Mar 2005 05:31:56 -0000 1.4 --- ThrusterMotorData.h 28 Mar 2005 22:33:07 -0000 1.5 *************** *** 44,48 **** solid = NULL; internal_solidIndex = 0; ! internal_solidName = ""; force.singleStep = true; } --- 44,48 ---- solid = NULL; internal_solidIndex = 0; ! solidBlueprintRefName = ""; force.singleStep = true; } *************** *** 67,71 **** solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! internal_solidName = data.internal_solidName; force = data.force; } --- 67,71 ---- solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! solidBlueprintRefName = data.solidBlueprintRefName; force = data.force; } *************** *** 77,82 **** int internal_solidIndex; ! /// Internal data used for Blueprint instantiation. ! std::string internal_solidName; /// The Force that gets applied to the Solid every time step. --- 77,82 ---- int internal_solidIndex; ! /// String used for for intra-Blueprint references. ! std::string solidBlueprintRefName; /// The Force that gets applied to the Solid every time step. Index: ServoMotorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/ServoMotorData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ServoMotorData.h 11 Mar 2005 05:31:56 -0000 1.4 --- ServoMotorData.h 28 Mar 2005 22:33:07 -0000 1.5 *************** *** 56,60 **** joint = NULL; internal_jointIndex = 0; ! internal_jointName = ""; mode = DESIRED_ANGLE_MODE; jointAxisNum = 0; --- 56,60 ---- joint = NULL; internal_jointIndex = 0; ! jointBlueprintRefName = ""; mode = DESIRED_ANGLE_MODE; jointAxisNum = 0; *************** *** 83,87 **** joint = data.joint; internal_jointIndex = data.internal_jointIndex; ! internal_jointName = data.internal_jointName; mode = data.mode; jointAxisNum = data.jointAxisNum; --- 83,87 ---- joint = data.joint; internal_jointIndex = data.internal_jointIndex; ! jointBlueprintRefName = data.jointBlueprintRefName; mode = data.mode; jointAxisNum = data.jointAxisNum; *************** *** 98,103 **** int internal_jointIndex; ! /// Internal data used for Blueprint instantiation. ! std::string internal_jointName; /// The Motor's mode of operation. --- 98,103 ---- int internal_jointIndex; ! /// String used for for intra-Blueprint references. ! std::string jointBlueprintRefName; /// The Motor's mode of operation. Index: VolumeSensorData.h =================================================================== RCS file: /cvsroot/opal/opal/src/VolumeSensorData.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VolumeSensorData.h 13 Mar 2005 23:07:11 -0000 1.2 --- VolumeSensorData.h 28 Mar 2005 22:33:07 -0000 1.3 *************** *** 63,67 **** solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! internal_solidName = data.internal_solidName; transform = data.transform; } --- 63,67 ---- solid = data.solid; internal_solidIndex = data.internal_solidIndex; ! solidBlueprintRefName = data.solidBlueprintRefName; transform = data.transform; } Index: JointData.h =================================================================== RCS file: /cvsroot/opal/opal/src/JointData.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** JointData.h 11 Mar 2005 05:31:56 -0000 1.6 --- JointData.h 28 Mar 2005 22:33:07 -0000 1.7 *************** *** 91,96 **** internal_solid0Index = 0; internal_solid1Index = 0; ! internal_solid0Name = ""; ! internal_solid1Name = ""; anchor = defaults::joint::anchor; axis[0].direction = defaults::joint::axis0Direction; --- 91,96 ---- internal_solid0Index = 0; internal_solid1Index = 0; ! solid0BlueprintRefName = ""; ! solid1BlueprintRefName = ""; anchor = defaults::joint::anchor; axis[0].direction = defaults::joint::axis0Direction; *************** *** 126,131 **** internal_solid0Index = data.internal_solid0Index; internal_solid1Index = data.internal_solid1Index; ! internal_solid0Name = data.internal_solid0Name; ! internal_solid1Name = data.internal_solid1Name; anchor = data.anchor; --- 126,131 ---- internal_solid0Index = data.internal_solid0Index; internal_solid1Index = data.internal_solid1Index; ! solid0BlueprintRefName = data.solid0BlueprintRefName; ! solid1BlueprintRefName = data.solid1BlueprintRefName; anchor = data.anchor; *************** *** 172,180 **** int internal_solid1Index; ! /// Internal data used for Blueprint instantiation. ! std::string internal_solid0Name; ! /// Internal data used for Blueprint instantiation. ! std::string internal_solid1Name; /// The anchor point for this Joint. This is not used for every --- 172,180 ---- int internal_solid1Index; ! /// String used for for intra-Blueprint references. ! std::string solid0BlueprintRefName; ! /// String used for for intra-Blueprint references. ! std::string solid1BlueprintRefName; /// The anchor point for this Joint. This is not used for every |
|
From: tylerstreeter <tyl...@us...> - 2005-03-28 22:33:16
|
Update of /cvsroot/opal/opal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4923 Modified Files: todo.txt Log Message: renamed an "internal_" variable to make it not internal; specifically, renamed the reference string names used within Blueprints; these should be usable by the users, so they shouldn't be named "internal_" Index: todo.txt =================================================================== RCS file: /cvsroot/opal/opal/todo.txt,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** todo.txt 25 Mar 2005 04:18:59 -0000 1.61 --- todo.txt 28 Mar 2005 22:33:08 -0000 1.62 *************** *** 2,10 **** ================= ! * incline/orientation sensor: measures current orientation relative to an initial orientation; returns 3 reals - add example to sensors tutorial * add license notice to samples' source files For Version 0.4.0 ================= --- 2,13 ---- ================= ! * incline/orientation sensor: takes a local rotation axis; measures the angle the Solid has moved around that local axis; returns a real value (angle in degrees) ! - doesn't use teh sensor's transform - add example to sensors tutorial * add license notice to samples' source files + * clean up samples + For Version 0.4.0 ================= |
|
From: tylerstreeter <tyl...@us...> - 2005-03-28 22:33:15
|
Update of /cvsroot/opal/opal/samples/simple_objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4923/samples/simple_objects Modified Files: main.cpp Log Message: renamed an "internal_" variable to make it not internal; specifically, renamed the reference string names used within Blueprints; these should be usable by the users, so they shouldn't be named "internal_" Index: main.cpp =================================================================== RCS file: /cvsroot/opal/opal/samples/simple_objects/main.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** main.cpp 21 Mar 2005 04:29:05 -0000 1.26 --- main.cpp 28 Mar 2005 22:33:06 -0000 1.27 *************** *** 128,132 **** { opal::Matrix44r offset; ! offset.translate(0, 10, 0); // Instantiate the Blueprint. --- 128,132 ---- { opal::Matrix44r offset; ! offset.translate(0, 2, 0); // Instantiate the Blueprint. |
|
From: tylerstreeter <tyl...@us...> - 2005-03-28 20:08:07
|
Update of /cvsroot/opal/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9551 Modified Files: documentation.html tutorial4.html tutorial8.html Log Message: added tutorial on contact groups Index: tutorial8.html =================================================================== RCS file: /cvsroot/opal/web/tutorial8.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tutorial8.html 26 Mar 2005 17:34:52 -0000 1.1 --- tutorial8.html 28 Mar 2005 20:07:54 -0000 1.2 *************** *** 25,44 **** <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>173</o:Revision> ! <o:TotalTime>364</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-26T17:17:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>540</o:Words> ! <o:Characters>3084</o:Characters> <o:Company>none</o:Company> ! <o:Lines>25</o:Lines> <o:Paragraphs>7</o:Paragraphs> ! <o:CharactersWithSpaces>3617</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>90</w:Zoom> <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> --- 25,45 ---- <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>204</o:Revision> ! <o:TotalTime>431</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T20:05:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>570</o:Words> ! <o:Characters>3250</o:Characters> <o:Company>none</o:Company> ! <o:Lines>27</o:Lines> <o:Paragraphs>7</o:Paragraphs> ! <o:CharactersWithSpaces>3813</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>75</w:Zoom> ! <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> *************** *** 81,84 **** --- 82,88 ---- text-decoration:underline; text-underline:single;} + span.SpellE + {mso-style-name:""; + mso-spl-e:yes;} @page Section1 {size:8.5in 11.0in; *************** *** 108,112 **** </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="64514"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> --- 112,116 ---- </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="66562"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> *************** *** 141,186 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Sensors ! acquire information from a simulation.<span style='mso-spacerun:yes'> ! </span>There are several types of Sensors, including Acceleration Sensors, ! Raycast Sensors, and Volume Sensors.<span style='mso-spacerun:yes'> ! </span>This tutorial will show how to setup each type.<span ! style='mso-spacerun:yes'> </span>It will also give examples of how each type ! could be used.<span style='mso-spacerun:yes'> </span>Keep in mind that a ! Sensor can either be attached to a Solid or just positioned somewhere in the ! environment.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Lets ! first create all the objects well need (and assume they will be initialized ! elsewhere):<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left ! style='background:silver;border-collapse:collapse;border:none;mso-border-alt: ! solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: ! 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: ! page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> ! <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> ! <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; ! mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; ! height:22.95pt'> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! solid = sim->createSolid();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! </td> ! </tr> ! </table> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Acceleration ! Sensor<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! first Sensor we will use here is an Acceleration Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 145,195 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Usually ! all Solid/Solid collisions generate physical contacts that keep them from ! interpenetrating.<span style='mso-spacerun:yes'> </span>Sometimes this is ! not desired, either for performance reasons (fewer constraints means faster ! simulation) or for special effects.<span style='mso-spacerun:yes'> ! </span>Contact groups can be used to enable <span class=SpellE>forcefields</span> ! that repel only a subset of objects, efficient ray casts that only collide ! with certain objects, invisible trigger volumes that generate collision ! events but dont make physical contacts with anything, etc.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>It is + important to note the difference between collision events and contacts + the way OPAL defines them.<span style='mso-spacerun:yes'> </span>Collision events + occur whenever two Solids collide (but are only handled if at least one of + the two Solids uses a collision event handler).<span + style='mso-spacerun:yes'> </span>Contacts are physical constraints that keep + Solids from penetrating one another.<span style='mso-spacerun:yes'> + </span>Solids can use collision events and/or contacts.<span + style='mso-spacerun:yes'> </span>By default, every collision group generates + contacts, and every Shape starts in group 0.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Every + OPAL Shape is in one (and only one) contact group.<span + style='mso-spacerun:yes'> </span>A contact group can be set to enable or + disable contacts with other contact groups, including itself. <span + style='mso-spacerun:yes'> </span>For example, if groups 5 and 8 are set not + to generate contacts, object A is in group 5, and object B is in group 8, + objects A and B will pass through one another when they collide.<span + style='mso-spacerun:yes'> </span>OPAL can use up to 32 different contact + groups.<span style='mso-spacerun:yes'> </span>Contact groups always work + both ways between two groups: if group X makes contacts with group Y, group Y + will make contacts with group X.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-family:"Book Antiqua";color:black'>Warning:</span></b><span ! style='font-family:"Book Antiqua";color:black'> Because the contact group ! interactions are always two-way, be careful about the order in which you ! setup the groups.<span style='mso-spacerun:yes'> </span>If you set group 3 ! not to make contacts with group 5, then set group 5 to make contacts with ! group 3, the two groups will make contacts.<span style='mso-spacerun:yes'> ! </span><o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Here ! is an example that shows how to create three objects: object A, object B, and ! object C.<span style='mso-spacerun:yes'> </span>We will generate contacts ! only between objects A and B and objects B and C, but not between objects B ! and C:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 194,213 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::AccelerationSensorData ! data;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.solid ! = solid;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.transform.translate(4, ! 0, -1);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::AccelerationSensor* ! accelSensor = sim->createAccelerationSensor();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>accelSensor->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Vec3r ! accel = accelSensor-></span><span style='font-size:10.0pt;font-family: ! "Courier New";color:windowtext'>getGlobalLinearAccel();</span><span ! style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 203,257 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Simulator</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>sim</span> = <span class=SpellE>opal::createSimulator</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Create ! three Solids, each with a Shape in a different contact group.<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::SphereShapeData</span></span><span style='font-family: ! Courier;color:black'> <span class=SpellE>sphereData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>objectA</span> = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sphereData.contactGroup</span></span><span style='font-family: ! Courier;color:black'> = 1;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>objectA</span></span><span style='font-family:Courier; ! color:black'>-><span class=SpellE>addShape</span>(<span class=SpellE>sphereData</span>);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>objectB</span> = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sphereData.contactGroup</span></span><span style='font-family: ! Courier;color:black'> = 2;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>objectB</span></span><span style='font-family:Courier; ! color:black'>-><span class=SpellE>addShape</span>(<span class=SpellE>sphereData</span>);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>objectC</span> = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sphereData.contactGroup</span></span><span style='font-family: ! Courier;color:black'> = 3;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>objectC</span></span><span style='font-family:Courier; ! color:black'>-><span class=SpellE>addShape</span>(<span class=SpellE>sphereData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Setup ! the contact groups.<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sim</span></span><span style='font-family:Courier;color:black'>-><span ! class=SpellE>setupContactGroups</span>(1, 2, true);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sim</span></span><span style='font-family:Courier;color:black'>-><span ! class=SpellE>setupContactGroups</span>(2, 3, true);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sim</span></span><span style='font-family:Courier;color:black'>-><span ! class=SpellE>setupContactGroups</span>(1, 3, false);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 225,285 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The - Sensor is automatically attached to the Solid if its Solid pointer is - set.<span style='mso-spacerun:yes'> </span>It calculates the linear and angular - acceleration of the attached Solid at the point of the Sensor (which can be - offset from the Solid by using the Sensors transform).<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span - style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Raycast - Sensor<o:p></o:p></span></b></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The - next Sensor is the Raycast Sensor:<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left - style='background:silver;border-collapse:collapse;border:none;mso-border-alt: - solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: - 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: - page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> - <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> - <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; - mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; - height:22.95pt'> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::RaycastSensorData - data;<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>data.solid - = solid;<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>data.ray.setOrigin(opal::Point3r(0, - 0, 0));<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>data.ray.setDir(opal::Vec3r(0, - 0, -1));<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>data.contactGroup - = 2;<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::RaycastSensor* - raySensor = sim->createRaycastSensor();<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>raySensor->init(data);<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::RaycastResult - result = raySensor-></span><span style='font-family:Courier;mso-bidi-font-family: - "Courier New";color:windowtext'>fireRay();<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: - "Courier New";color:windowtext'>opal::Point3r hitPoint = - result.intersection;<o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: - "Courier New";color:windowtext'>opal::Solid* hitSolid = result.solid;</span><span - style='font-family:Courier;color:black'><o:p></o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - </td> - </tr> - </table> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 269,272 ---- *************** *** 291,308 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Raycast ! Sensors must be fired manually they do not update anything every time ! step.<span style='mso-spacerun:yes'> </span>When they are fired, they cast a ! ray into the environment and return data describing the closest point of ! intersection (if any) from the rays origin.<span style='mso-spacerun:yes'> ! </span>The Raycast Sensor uses a contact group to limit which objects it ! collides with.<span style='mso-spacerun:yes'> </span>(See other tutorials ! for more information on contact groups.)<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><span ! style='mso-spacerun:yes'> </span><o:p></o:p></span></p> ! <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Volume Sensor<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! Volume Sensor is similar to the Raycast Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 278,283 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>To setup ! an object that doesnt make contacts with anything else, do the following:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 316,370 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::VolumeSensorData ! data;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.contactGroup ! = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal:: ! VolumeSensor* volSensor = sim->createVolumeSensor();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>volSensor->init(data);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>// Define ! a volume Solid.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! volume = sim->createSolid();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::SphereShapeData ! sphereData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sphereData.radius ! = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>volume->addShape(sphereData);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::VolumeQueryResult ! result = volSensor-></span><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>queryVolume(volume);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>for (int i=0; i<result.getNumSolids(); ! ++i)<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>{<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>opal::Solid* s = result.getSolid(i);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>opal::Force f;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.type = opal::GLOBAL_FORCE;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.duration = (opal::real)0.05;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.vec = s->getPosition() volume->getPosition();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.vec *= 100;<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>s->addForce(f);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>}<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 291,312 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Simulator</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>sim</span> = <span class=SpellE>opal::createSimulator</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::BoxShapeData</span></span><span style='font-family:Courier; ! color:black'> <span class=SpellE>boxData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>boxData.contactGroup</span></span><span style='font-family: ! Courier;color:black'> = 15;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* trigger = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>trigger-><span ! class=SpellE>addShape</span>(<span class=SpellE>boxData</span>);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sim</span></span><span style='font-family:Courier;color:black'>-><span ! class=SpellE>setupContactGroup</span>(15, false);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 372,388 **** </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 314,317 ---- *************** *** 393,410 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> - <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Volume - Sensors take a volume Solid and query the environment for Solids that - collide with the volume Solid.<span style='mso-spacerun:yes'> </span>The - resulting data structure contains a list of pointers to those Solids.<span - style='mso-spacerun:yes'> </span>Like Raycast Sensors, they can utilize - contact groups to limit the set of Solids that are collided with the volume - Solid; simply set the contact group of the volume Solid.<span - style='mso-spacerun:yes'> </span>They also are not updated every time step; - they must be queried manually.<span style='mso-spacerun:yes'> </span>The example - above shows how to simulate an explosion: it finds all the Solids within a 5 - unit radius from the volumes center and applies an outward force on each - object scaled linearly by its distance from the center.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 322,342 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The <span + class=SpellE>setupContactGroup</span> function sets up the interaction + between a contact group and every other contact group at once, making it easy + to create a trigger volume object that doesnt affect anything else physically + but can still generate collision events.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>When + using the <span class=SpellE>RaycastSensor</span> and <span class=SpellE>VolumeSensor</span>, + keep in mind that contact groups can be used to make more efficient collision + queries.<span style='mso-spacerun:yes'> </span>Remember, the <span + class=SpellE>VolumeSensor</span> takes a pointer to a volume Solid and checks + which other Solids collide with that Solid.<span style='mso-spacerun:yes'> + </span>Simply use a contact group on the volume Solids Shape(s).<span + style='mso-spacerun:yes'> </span>The <span class=SpellE>RaycastSensor</span> + has an explicit contact group that can be setup to limit which other groups + it collides with.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> Index: tutorial4.html =================================================================== RCS file: /cvsroot/opal/web/tutorial4.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tutorial4.html 28 Mar 2005 18:45:53 -0000 1.4 --- tutorial4.html 28 Mar 2005 20:07:54 -0000 1.5 *************** *** 25,44 **** <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>174</o:Revision> ! <o:TotalTime>310</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T18:44:00Z</o:LastSaved> ! <o:Pages>3</o:Pages> ! <o:Words>623</o:Words> ! <o:Characters>3552</o:Characters> <o:Company>none</o:Company> <o:Lines>29</o:Lines> <o:Paragraphs>8</o:Paragraphs> ! <o:CharactersWithSpaces>4167</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>80</w:Zoom> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> --- 25,44 ---- <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>175</o:Revision> ! <o:TotalTime>311</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T18:49:00Z</o:LastSaved> ! <o:Pages>1</o:Pages> ! <o:Words>622</o:Words> ! <o:Characters>3548</o:Characters> <o:Company>none</o:Company> <o:Lines>29</o:Lines> <o:Paragraphs>8</o:Paragraphs> ! <o:CharactersWithSpaces>4162</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>75</w:Zoom> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> *************** *** 112,116 **** </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="63490"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> --- 112,116 ---- </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="64514"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> *************** *** 195,199 **** <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Attractor ! Motors<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Now well make an Attractor Motor and initialize it:<o:p></o:p></span></p> --- 195,199 ---- <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Attractor ! Motor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Now well make an Attractor Motor and initialize it:<o:p></o:p></span></p> *************** *** 247,251 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Geared Motors<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Next, lets make a Geared Motor:<o:p></o:p></span></p> --- 247,251 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Geared Motor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Next, lets make a Geared Motor:<o:p></o:p></span></p> *************** *** 306,310 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Servo Motors<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The next Motor is a Servo Motor:<o:p></o:p></span></p> --- 306,310 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Servo Motor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The next Motor is a Servo Motor:<o:p></o:p></span></p> *************** *** 364,377 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Servo will continually use up to its max torque to try to achieve its desired ! angle.<span style='mso-spacerun:yes'> </span>Servos are extremely stable ! controllers, similar to PD or PID controllers.<span ! style='mso-spacerun:yes'> </span>They make automatic adjustments to keep ! from overshoot their target angle.<span style='mso-spacerun:yes'> ! </span>Servos are really good for robot simulations: the robot can simply set ! its desired Joint angles, and the Servo automatically provides enough torque ! to reach that angle without overshooting.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Spring Motors<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>A Spring Motor is a simple linear and/or <span class=SpellE>torsional</span> --- 364,377 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Servo will continually use up to its max torque to try to achieve its desired ! angle.<span style='mso-spacerun:yes'> </span>Servos are extremely stable controllers, ! similar to PD or PID controllers.<span style='mso-spacerun:yes'> </span>They ! make automatic adjustments to keep from overshoot their target angle.<span ! style='mso-spacerun:yes'> </span>Servos are really good for robot ! simulations: the robot can simply set its desired Joint angles, and the Servo ! automatically provides enough torque to reach that angle without ! overshooting.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Spring Motor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>A Spring Motor is a simple linear and/or <span class=SpellE>torsional</span> *************** *** 447,453 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Springs ! are good for all kinds of things.<span style='mso-spacerun:yes'> </span>In ! an application with 3D graphics you can connect a Spring to your camera and ! have it smoothly move from one desired position/orientation to the next.<span style='mso-spacerun:yes'> </span>They are also great for picking up objects: simply attach the selected object to a Spring with its desired position --- 447,453 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Springs ! are good for all kinds of things.<span style='mso-spacerun:yes'> </span>In an ! application with 3D graphics you can connect a Spring to your camera and have ! it smoothly move from one desired position/orientation to the next.<span style='mso-spacerun:yes'> </span>They are also great for picking up objects: simply attach the selected object to a Spring with its desired position *************** *** 456,460 **** <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Thruster ! Motors<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The final Motor is a Thruster:<o:p></o:p></span></p> --- 456,460 ---- <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Thruster ! Motor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The final Motor is a Thruster:<o:p></o:p></span></p> Index: documentation.html =================================================================== RCS file: /cvsroot/opal/web/documentation.html,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** documentation.html 28 Mar 2005 18:45:44 -0000 1.13 --- documentation.html 28 Mar 2005 20:07:53 -0000 1.14 *************** *** 25,44 **** <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>106</o:Revision> <o:TotalTime>111</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T16:52:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>297</o:Words> ! <o:Characters>1696</o:Characters> <o:Company>none</o:Company> <o:Lines>14</o:Lines> <o:Paragraphs>3</o:Paragraphs> ! <o:CharactersWithSpaces>1990</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>90</w:Zoom> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> --- 25,44 ---- <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>107</o:Revision> <o:TotalTime>111</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T18:49:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>296</o:Words> ! <o:Characters>1693</o:Characters> <o:Company>none</o:Company> <o:Lines>14</o:Lines> <o:Paragraphs>3</o:Paragraphs> ! <o:CharactersWithSpaces>1986</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>75</w:Zoom> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> *************** *** 99,103 **** </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="61442"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> --- 99,103 ---- </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="62466"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> *************** *** 178,186 **** color:black'>Documentation<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>If ! you are using OPAL for the first time, it is recommended that you read ! through the documentation in the following order: 1) overview, 2) tutorials, ! 3) API reference.<span style='mso-spacerun:yes'> </span>The overview and ! tutorials do not cover everything; they exist to help you learn to use OPAL quickly.<span style='mso-spacerun:yes'> </span>Consult the API reference for more details.<o:p></o:p></span></p> --- 178,186 ---- color:black'>Documentation<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>If you ! are using OPAL for the first time, it is recommended that you read through ! the documentation in the following order: 1) overview, 2) tutorials, 3) API ! reference.<span style='mso-spacerun:yes'> </span>The overview and tutorials ! do not cover everything; they exist to help you learn to use OPAL quickly.<span style='mso-spacerun:yes'> </span>Consult the API reference for more details.<o:p></o:p></span></p> *************** *** 221,229 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-size:14.0pt;font-family:"Book Antiqua"; ! color:black'><a href="tutorial7.html">Tutorial 8</a></span><span style='font-family:"Book Antiqua";color:black'>: Contact Groups<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-size:14.0pt;font-family:"Book Antiqua"; ! color:black'><a href="tutorial8.html">Tutorial 9</a></span><span style='font-family:"Book Antiqua";color:black'>: Blueprints and OPAL XML Files<o:p></o:p></span></p> --- 221,229 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-size:14.0pt;font-family:"Book Antiqua"; ! color:black'><a href="tutorial8.html">Tutorial 8</a></span><span style='font-family:"Book Antiqua";color:black'>: Contact Groups<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-size:14.0pt;font-family:"Book Antiqua"; ! color:black'><a href="tutorial9.html">Tutorial 9</a></span><span style='font-family:"Book Antiqua";color:black'>: Blueprints and OPAL XML Files<o:p></o:p></span></p> |
|
From: tylerstreeter <tyl...@us...> - 2005-03-28 18:46:10
|
Update of /cvsroot/opal/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31757 Modified Files: documentation.html overview.html todo.txt tutorial1.html tutorial3.html tutorial4.html tutorial5.html tutorial6.html tutorial7.html Log Message: added two new tutorials: #6 (data objects) and #7 (event handlers and user data) Index: tutorial3.html =================================================================== RCS file: /cvsroot/opal/web/tutorial3.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tutorial3.html 4 Mar 2005 03:45:32 -0000 1.2 --- tutorial3.html 28 Mar 2005 18:45:53 -0000 1.3 *************** *** 25,39 **** <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>138</o:Revision> ! <o:TotalTime>259</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-04T01:21:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>446</o:Words> ! <o:Characters>2543</o:Characters> <o:Company>none</o:Company> ! <o:Lines>21</o:Lines> ! <o:Paragraphs>5</o:Paragraphs> ! <o:CharactersWithSpaces>2984</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> --- 25,39 ---- <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>139</o:Revision> ! <o:TotalTime>260</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T17:41:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>464</o:Words> ! <o:Characters>2649</o:Characters> <o:Company>none</o:Company> ! <o:Lines>22</o:Lines> ! <o:Paragraphs>6</o:Paragraphs> ! <o:CharactersWithSpaces>3107</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> *************** *** 41,46 **** <w:WordDocument> <w:Zoom>90</w:Zoom> - <w:SpellingState>Clean</w:SpellingState> - <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> --- 41,44 ---- *************** *** 82,88 **** text-decoration:underline; text-underline:single;} - span.SpellE - {mso-style-name:""; - mso-spl-e:yes;} @page Section1 {size:8.5in 11.0in; --- 80,83 ---- *************** *** 112,116 **** </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="55298"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> --- 107,111 ---- </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="56322"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> *************** *** 147,157 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Joints connect two Solids, constraining their relative motion. There are ! several types of Joints, each constraining motion in different ways. <span ! style='mso-spacerun:yes'> </span>The available Joints are: Hinge Joints (one rotational degree of freedom), Universal Joints (two rotational degrees of ! freedom), Ball Joints (three rotational degrees of freedom), Wheel Joints (two ! rotational degrees of freedom; typically one axis coincides with a wheels ! axis, and the other is used for steering), Slider Joints (one translational ! degree of freedom), and Fixed Joints (zero rotational degrees of freedom).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Joints --- 142,153 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Joints connect two Solids, constraining their relative motion. There are ! several types of Joints, each constraining motion in different ways.<span ! style='mso-spacerun:yes'> </span>The available Joints are: Hinge Joints (one rotational degree of freedom), Universal Joints (two rotational degrees of ! freedom), Ball Joints (three rotational degrees of freedom), Wheel Joints ! (two rotational degrees of freedom; typically one axis coincides with a ! wheels axis, and the other is used for steering), Slider Joints (one ! translational degree of freedom), and Fixed Joints (zero rotational degrees ! of freedom).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Joints *************** *** 168,178 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Simulator</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>sim</span> = <span class=SpellE>opal::createSimulator</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Joint</span></span><span style='font-family:Courier; ! color:black'>* joint = <span class=SpellE>sim</span>-><span ! class=SpellE>createJoint</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 164,171 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Joint* ! joint = sim->createJoint();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 185,191 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Before ! using the Joint, it must be initialized with a <span class=SpellE>JointData</span> ! object.<span style='mso-spacerun:yes'> </span>Before it can be initialized, ! you must create two Solids and position them:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 178,184 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Before ! using the Joint, it must be initialized with a JointData object.<span ! style='mso-spacerun:yes'> </span>Before it can be initialized, you must ! create two Solids and position them:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 199,246 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* solid0 = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::BoxShapeData</span></span><span style='font-family:Courier; ! color:black'> <span class=SpellE>boxData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid0-><span ! class=SpellE>addShape</span>(<span class=SpellE>boxData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* solid1 = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Matrix44r solid1Transform;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1Transform.translate(0.0, 1.5, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1-><span ! class=SpellE>setTransform</span>(solid1Transform);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::CapsuleShapeData</span></span><span style='font-family: ! Courier;color:black'> <span class=SpellE>capsuleData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1-><span ! class=SpellE>addShape</span>(<span class=SpellE>capsuleData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::JointData</span></span><span style='font-family:Courier; ! color:black'> <span class=SpellE>jointData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.setType</span></span><span style='font-family:Courier; ! color:black'>(<span class=SpellE>opal::HINGE_JOINT</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid0 = solid0;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid1 = solid1;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.anchor</span></span><span style='font-family:Courier; ! color:black'> = opal::Point3r(0.0, 0.75, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.axis</span></span><span style='font-family:Courier; ! color:black'>[0].direction = opal::Vec3r(1.0, 0.0, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>joint->init(<span ! class=SpellE>jointData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 192,224 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! solid0 = sim->createSolid();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::BoxShapeData ! boxData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid0->addShape(boxData);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! solid1 = sim->createSolid();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Matrix44r solid1Transform;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1Transform.translate(0.0, 1.5, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1->setTransform(solid1Transform);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::CapsuleShapeData ! capsuleData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>solid1->addShape(capsuleData);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::JointData ! jointData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.setType(opal::HINGE_JOINT);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid0 = solid0;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid1 = solid1;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.anchor ! = opal::Point3r(0.0, 0.75, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.axis[0].direction ! = opal::Vec3r(1.0, 0.0, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>joint->init(jointData);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 271,276 **** static environment by simply setting the Joints other Solid to NULL.<span style='mso-spacerun:yes'> </span>Joints can have limits for each of their ! degrees of freedom.<span style='mso-spacerun:yes'> </span>Lets create another ! Joint with some limits:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 249,254 ---- static environment by simply setting the Joints other Solid to NULL.<span style='mso-spacerun:yes'> </span>Joints can have limits for each of their ! degrees of freedom.<span style='mso-spacerun:yes'> </span>Lets create ! another Joint with some limits:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 284,314 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::JointData</span></span><span style='font-family:Courier; ! color:black'> <span class=SpellE>jointData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.setType</span></span><span style='font-family:Courier; ! color:black'>(<span class=SpellE>opal::HINGE_JOINT</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid0 = solid0;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid1 = solid1;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.anchor</span></span><span style='font-family:Courier; ! color:black'> = opal::Point3r(0.0, 0.75, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.axis</span></span><span style='font-family:Courier; ! color:black'>[0].direction = opal::Vec3r(1.0, 0.0, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.axis</span></span><span style='font-family:Courier; ! color:black'>[0].<span class=SpellE>limitsEnabled</span> = true;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.axis</span></span><span style='font-family:Courier; ! color:black'>[0].<span class=SpellE>limits.low</span> = -45.0;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>jointData.axis</span></span><span style='font-family:Courier; ! color:black'>[0].<span class=SpellE>limits.high</span> = 25.0;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>joint->init(<span ! class=SpellE>jointData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 262,283 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::JointData ! jointData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.setType(opal::HINGE_JOINT);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid0 = solid0;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.solid1 = solid1;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.anchor ! = opal::Point3r(0.0, 0.75, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.axis[0].direction ! = opal::Vec3r(1.0, 0.0, 0.0);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.axis[0].limitsEnabled ! = true;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.axis[0].limits.low ! = -45.0;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>jointData.axis[0].limits.high ! = 25.0;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>joint->init(jointData);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 328,337 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>By ! default, Joints are unbreakable: they can withstand unlimited amounts of ! stress.<span style='mso-spacerun:yes'> </span>Joints can also be setup as ! breakable Joints.<span style='mso-spacerun:yes'> </span>The following code ! sets up an existing Joint in threshold break mode (when the combined force ! and torque on the Joint exceeds some threshold, it breaks):<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 297,306 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>By default, ! Joints are unbreakable: they can withstand unlimited amounts of stress.<span ! style='mso-spacerun:yes'> </span>Joints can also be setup as breakable ! Joints.<span style='mso-spacerun:yes'> </span>The following code sets up an ! existing Joint in threshold break mode (when the combined force and torque ! on the Joint exceeds some threshold, it breaks):<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 346,351 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>joint-><span ! class=SpellE>setBreakParams</span>(<span class=SpellE>opal::THRESHOLD_MODE</span>, 3.0);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 315,319 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>joint->setBreakParams(opal::THRESHOLD_MODE, 3.0);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> *************** *** 359,366 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Another Joint break mode in OPAL is accumulated mode: stress is accumulated until ! it exceeds a threshold, at which point the Joint breaks.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>When ! you are done with a Joint, tell the Simulator to destroy it:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 327,337 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Another Joint break mode in OPAL is accumulated mode: stress is accumulated until ! it exceeds a threshold, at which point the Joint breaks.<span ! style='mso-spacerun:yes'> </span>When a Joint breaks, it is immediately ! disabled, and the Joints JointBreakEventHandler is notified (if one has been ! set).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>When you ! are done with a Joint, tell the Simulator to destroy it:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 375,381 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sim</span></span><span style='font-family:Courier;color:black'>-><span ! class=SpellE>destroySolid</span>(joint);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 346,350 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->destroySolid(joint);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 399,404 **** <p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center'><span style='font-size:8.0pt;font-family:"Book Antiqua";mso-bidi-font-family:Arial; ! color:black'>OPAL is Copyright © 2004-2005 Alan Fischer, Andres Reinot, and ! Tyler Streeter<o:p></o:p></span></p> </div> --- 368,373 ---- <p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center'><span style='font-size:8.0pt;font-family:"Book Antiqua";mso-bidi-font-family:Arial; ! color:black'>OPAL is Copyright © 2004-2005 Alan Fischer, Andres Reinot, and Tyler ! Streeter<o:p></o:p></span></p> </div> Index: tutorial5.html =================================================================== RCS file: /cvsroot/opal/web/tutorial5.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tutorial5.html 23 Mar 2005 20:26:23 -0000 1.3 --- tutorial5.html 28 Mar 2005 18:45:53 -0000 1.4 *************** *** 25,44 **** <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>167</o:Revision> ! <o:TotalTime>357</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-23T20:15:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>539</o:Words> ! <o:Characters>3078</o:Characters> <o:Company>none</o:Company> ! <o:Lines>25</o:Lines> <o:Paragraphs>7</o:Paragraphs> ! <o:CharactersWithSpaces>3610</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> --- 25,44 ---- <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>169</o:Revision> ! <o:TotalTime>358</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T18:44:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>557</o:Words> ! <o:Characters>3180</o:Characters> <o:Company>none</o:Company> ! <o:Lines>26</o:Lines> <o:Paragraphs>7</o:Paragraphs> ! <o:CharactersWithSpaces>3730</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:Zoom>75</w:Zoom> <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> *************** *** 81,87 **** text-decoration:underline; text-underline:single;} - span.SpellE - {mso-style-name:""; - mso-spl-e:yes;} @page Section1 {size:8.5in 11.0in; --- 81,84 ---- *************** *** 111,115 **** </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="61442"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> --- 108,112 ---- </style> <![endif]--><!--[if gte mso 9]><xml> ! <o:shapedefaults v:ext="edit" spidmax="63490"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> *************** *** 146,156 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Sensors acquire information from a simulation.<span style='mso-spacerun:yes'> ! </span>There are several types of Sensors, including Acceleration Sensors, <span ! class=SpellE>Raycast</span> Sensors, and Volume Sensors.<span ! style='mso-spacerun:yes'> </span>This tutorial will show how to setup each ! type.<span style='mso-spacerun:yes'> </span>It will also give examples of ! how each type could be used.<span style='mso-spacerun:yes'> </span>Keep in ! mind that a Sensor can either be attached to a Solid or just positioned ! somewhere in the environment.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Lets --- 143,153 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Sensors acquire information from a simulation.<span style='mso-spacerun:yes'> ! </span>There are several types of Sensors, including Acceleration Sensors, ! Raycast Sensors, and Volume Sensors.<span style='mso-spacerun:yes'> ! </span>This tutorial will show how to setup each type.<span ! style='mso-spacerun:yes'> </span>It will also give examples of how each type ! could be used.<span style='mso-spacerun:yes'> </span>Keep in mind that a ! Sensor can either be attached to a Solid or just positioned somewhere in the ! environment.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Lets *************** *** 168,178 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Simulator</span></span><span style='font-family:Courier; ! color:black'>* <span class=SpellE>sim</span> = <span class=SpellE>opal::createSimulator</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* solid = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> --- 165,172 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Simulator* ! sim = opal::createSimulator();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! solid = sim->createSolid();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> *************** *** 200,227 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::AccelerationSensorData</span></span><span ! style='font-family:Courier;color:black'> data;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.solid</span></span><span style='font-family:Courier; ! color:black'> = solid;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.transform.translate</span></span><span style='font-family: ! Courier;color:black'>(4, 0, -1);<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::AccelerationSensor</span></span><span style='font-family: ! Courier;color:black'>* <span class=SpellE>accelSensor</span> = <span ! class=SpellE>sim</span>-><span class=SpellE>createAccelerationSensor</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>accelSensor</span></span><span style='font-family:Courier; ! color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Vec3r ! <span class=SpellE>accel</span> = <span class=SpellE>accelSensor</span>-></span><span ! class=SpellE><span style='font-size:10.0pt;font-family:"Courier New"; ! color:windowtext'>getGlobalLinearAccel</span></span><span style='font-size: ! 10.0pt;font-family:"Courier New";color:windowtext'>();</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 194,212 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::AccelerationSensorData ! data;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.solid ! = solid;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.transform.translate(4, ! 0, -1);<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::AccelerationSensor* ! accelSensor = sim->createAccelerationSensor();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>accelSensor->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Vec3r ! accel = accelSensor-></span><span style='font-size:10.0pt;font-family: ! "Courier New";color:windowtext'>getGlobalLinearAccel();</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> *************** *** 240,254 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! Sensor is automatically attached to the Solid if its Solid pointer is ! set.<span style='mso-spacerun:yes'> </span>It calculates the linear and ! angular acceleration of the attached Solid at the point of the Sensor (which ! can be offset from the Solid by using the Sensors transform).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Raycast ! Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! next Sensor is the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 225,238 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Sensor ! is automatically attached to the Solid if its Solid pointer is set.<span ! style='mso-spacerun:yes'> </span>It calculates the linear and angular ! acceleration of the attached Solid at the point of the Sensor (which can be ! offset from the Solid by using the Sensors transform).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Raycast Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! next Sensor is the Raycast Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 262,303 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::RaycastSensorData</span></span><span style='font-family: ! Courier;color:black'> data;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.solid</span></span><span style='font-family:Courier; ! color:black'> = solid;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.ray.setOrigin</span></span><span style='font-family:Courier; ! color:black'>(opal::Point3r(0, 0, 0));<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.ray.setDir</span></span><span style='font-family:Courier; ! color:black'>(opal::Vec3r(0, 0, -1));<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.contactGroup</span></span><span style='font-family:Courier; ! color:black'> = 2;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::RaycastSensor</span></span><span style='font-family: ! Courier;color:black'>* <span class=SpellE>raySensor</span> = <span ! class=SpellE>sim</span>-><span class=SpellE>createRaycastSensor</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>raySensor</span></span><span style='font-family:Courier; ! color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::RaycastResult</span></span><span style='font-family: ! Courier;color:black'> result = <span class=SpellE>raySensor</span>-></span><span ! class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; ! color:windowtext'>fireRay</span></span><span style='font-family:Courier; ! mso-bidi-font-family:"Courier New";color:windowtext'>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>opal::Point3r <span class=SpellE>hitPoint</span> ! = <span class=SpellE>result.intersection</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! mso-bidi-font-family:"Courier New";color:windowtext'>opal::Solid</span></span><span ! style='font-family:Courier;mso-bidi-font-family:"Courier New";color:windowtext'>* ! <span class=SpellE>hitSolid</span> = <span class=SpellE>result.solid</span>;</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> --- 246,273 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::RaycastSensorData ! data;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.solid ! = solid;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.ray.setOrigin(opal::Point3r(0, ! 0, 0));<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.ray.setDir(opal::Vec3r(0, ! 0, -1));<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.contactGroup ! = 2;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::RaycastSensor* ! raySensor = sim->createRaycastSensor();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>raySensor->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::RaycastResult ! result = raySensor-></span><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>fireRay();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>opal::Point3r hitPoint = ! result.intersection;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>opal::Solid* hitSolid = result.solid;</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> *************** *** 320,339 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; ! color:black'>Raycast</span></span><span style='font-family:"Book Antiqua"; ! color:black'> Sensors must be fired manually they do not update anything ! every time step.<span style='mso-spacerun:yes'> </span>When they are fired, ! they cast a ray into the environment and return data describing the closest point ! of intersection (if any) from the rays origin.<span ! style='mso-spacerun:yes'> </span>The <span class=SpellE>Raycast</span> ! Sensor uses a contact group to limit which objects it collides with.<span ! style='mso-spacerun:yes'> </span>(See other tutorials for more information ! on contact groups.)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Volume Sensor<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Volume ! Sensor is similar to the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left --- 290,307 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Raycast ! Sensors must be fired manually they do not update anything every time ! step.<span style='mso-spacerun:yes'> </span>When they are fired, they cast a ! ray into the environment and return data describing the closest point of ! intersection (if any) from the rays origin.<span style='mso-spacerun:yes'> ! </span>The Raycast Sensor uses a contact group to limit which objects it ! collides with.<span style='mso-spacerun:yes'> </span>(See other tutorials ! for more information on contact groups.)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Volume Sensor<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The ! Volume Sensor is similar to the Raycast Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left *************** *** 347,415 **** height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::VolumeSensorData</span></span><span style='font-family: ! Courier;color:black'> data;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>data.contactGroup</span></span><span style='font-family:Courier; ! color:black'> = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal:: <span ! class=SpellE>VolumeSensor</span>* <span class=SpellE>volSensor</span> = <span ! class=SpellE>sim</span>-><span class=SpellE>createVolumeSensor</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>volSensor</span></span><span style='font-family:Courier; ! color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>// Define a volume Solid.<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::Solid</span></span><span style='font-family:Courier; ! color:black'>* volume = <span class=SpellE>sim</span>-><span ! class=SpellE>createSolid</span>();<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::SphereShapeData</span></span><span style='font-family: ! Courier;color:black'> <span class=SpellE>sphereData</span>;<o:p></o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>sphereData.radius</span></span><span style='font-family:Courier; ! color:black'> = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>volume-><span ! class=SpellE>addShape</span>(<span class=SpellE>sphereData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; ! color:black'>opal::VolumeQueryResult</span></span><span style='font-family: ! Courier;color:black'> result = <span class=SpellE>volSensor</span>-></span><span ! class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; ! color:windowtext'>queryVolume</span></span><span style='font-family:Courier; ! mso-bidi-font-family:"Courier New";color:windowtext'>(volume);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>for (<span class=SpellE>int</span> <span ! class=SpellE>i</span>=0; <span class=SpellE>i</span><<span class=SpellE>result.getNumSolids</span>(); ! ++<span class=SpellE>i</span>)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>{<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>opal::Solid</span>* s = <span class=SpellE>result.getSolid</span>(<span ! class=SpellE>i</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>opal::Force</span> f;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.type</span> = <span class=SpellE>opal::GLOBAL_FORCE</span>;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.duration</span> = (<span class=SpellE>opal::real</span>)0.05;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.vec</span> = s-><span class=SpellE>getPosition</span>() ! volume-><span class=SpellE>getPosition</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span ! class=SpellE>f.vec</span> *= 100;<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>s-><span class=SpellE>addForce</span>(f);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>}<o:p></o:p></span></p> --- 315,367 ---- height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::VolumeSensorData ! data;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>data.contactGroup ! = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal:: ! VolumeSensor* volSensor = sim->createVolumeSensor();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>volSensor->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>// Define a volume Solid.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Solid* ! volume = sim->createSolid();<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::SphereShapeData ! sphereData;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>sphereData.radius ! = 5;<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>volume->addShape(sphereData);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::VolumeQueryResult ! result = volSensor-></span><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>queryVolume(volume);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'>for (int i=0; i<result.getNumSolids(); ! ++i)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>{<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>opal::Solid* s = result.getSolid(i);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>opal::Force f;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.type = opal::GLOBAL_FORCE;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.duration = (opal::real)0.05;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.vec = s->getPosition() volume->getPosition();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: ! "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>f.vec *= 100;<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> ! </span>s->addForce(f);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>}<o:p></o:p></span></p> *************** *** 442,458 **** <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Volume Sensors take a volume Solid and query the environment for Solids that collide with the volume Solid.<span style='mso-spacerun:yes'> </span>The resulting data structure contains a list of pointers to those Solids.<span ! style='mso-spacerun:yes'> </span>Like <span class=SpellE>Raycast</span> ! Sensors, they can utilize contact groups to limit the set of Solids that are ! collided with the volume Solid; simply set the contact group of the volume ! Solid.<span style='mso-spacerun:yes'> </span>They also are not updated every ! time step; they must be queried manually.<span style='mso-spacerun:yes'> ! </span>The example above shows how to simulate an explosion: it finds all the ! Solids within a 5 unit radius from the volumes center and applies an outward ! force on each object scaled linearly by its distance from the center.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> --- 394,433 ---- <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Volume Sensors take a volume Solid and query the environment for Solids that collide with the volume Solid.<span style='mso-spacerun:yes'> </span>The resulting data structure contains a list of pointers to those Solids.<span ! style='mso-spacerun:yes'> </span>Like Raycast Sensors, they can utilize ! contact groups to limit the set of Solids that are collided with the volume ! Solid; simply set the contact group of the volume Solid.<span ! style='mso-spacerun:yes'> </span>They also are not updated every time step; ! they must be queried manually.<span style='mso-spacerun:yes'> </span>The ! example above shows how to simulate an explosion: it finds all the Solids ! within a 5 unit radius from the volumes center and applies an outward force ! on each object scaled linearly by its distance from the center.<o:p></o:p></span></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> ! <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span ! style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Destroying Sensors<o:p></o:p></span></b></p> ! <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>When ! you are done with a Sensor, tell the Simulator to destroy it:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left + style='background:silver;border-collapse:collapse;border:none;mso-border-alt: + solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: + 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: + page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt; + mso-border-insideh:.25pt solid windowtext;mso-border-insidev:.25pt solid windowtext'> + <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> + <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; + mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; + height:22.95pt'> + <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> + <p class=MsoNormal><span style='font-family:Courier;color:black'>sim->destroySensor(sensor);<o:p></o:p></span></p> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> + </td> + </tr> + </table> + <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p></o:p></span></p> </td> </tr> Index: overview.html =================================================================== RCS file: /cvsroot/opal/web/overview.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** overview.html 23 Mar 2005 07:55:39 -0000 1.2 --- overview.html 28 Mar 2005 18:45:52 -0000 1.3 *************** *** 25,45 **** <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>101</o:Revision> ! <o:TotalTime>166</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-14T02:03:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>410</o:Words> ! <o:Characters>2341</o:Characters> <o:Company>none</o:Company> ! <o:Lines>19</o:Lines> <o:Paragraphs>5</o:Paragraphs> ! <o:CharactersWithSpaces>2746</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> ! <w:SpellingState>Clean</w:SpellingState> ! <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> --- 25,44 ---- <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> ! <o:Revision>103</o:Revision> ! <o:TotalTime>167</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> ! <o:LastSaved>2005-03-28T16:36:00Z</o:LastSaved> <o:Pages>1</o:Pages> ! <o:Words>430</o:Words> ! <o:Characters>2451</o:Characters> <o:Company>no... [truncated message content] |
|
From: tylerstreeter <tyl...@us...> - 2005-03-26 17:35:17
|
Update of /cvsroot/opal/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15778 Modified Files: documentation.html todo.txt Added Files: tutorial6.html tutorial7.html tutorial8.html tutorial9.html Log Message: added template pages for the rest of the tutorials Index: todo.txt =================================================================== RCS file: /cvsroot/opal/web/todo.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** todo.txt 23 Mar 2005 20:26:22 -0000 1.7 --- todo.txt 26 Mar 2005 17:34:52 -0000 1.8 *************** *** 13,16 **** --- 13,17 ---- - add diagrams - add more specific stuff; not just how to create things and call functions; show how to do common tasks (i.e. setup a car with motors on the front wheels); maybe just have a set of 'advanced' tutorials that combine things like this + - read through everything to make sure it makes sense and is actually helpful * in contact group tutorial, mention that they are used for object-object physical contacts and ray and volume sensors *************** *** 41,46 **** * write a "tutorial 0" or "tutorial intro" containing these notes, or just integrate them into the tutorials - * all objects are created with default parameters, including structs, so you don't have to initialize anything you don't want to - * describe the different between contacts and collision events - contacts are physical constraints that keep objects from passing through each other --- 42,45 ---- --- NEW FILE: tutorial7.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="tutorial7_files/filelist.xml"> <link rel=Edit-Time-Data href="tutorial7_files/editdata.mso"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <title>OPAL: Open Physics Abstraction Layer</title> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> <o:Revision>172</o:Revision> <o:TotalTime>364</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> <o:LastSaved>2005-03-26T17:17:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>540</o:Words> <o:Characters>3084</o:Characters> <o:Company>none</o:Company> <o:Lines>25</o:Lines> <o:Paragraphs>7</o:Paragraphs> <o:CharactersWithSpaces>3617</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>90</w:Zoom> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:Courier; panose-1:2 7 4 9 2 2 5 2 4 4; mso-font-charset:0; mso-generic-font-family:modern; mso-font-format:other; mso-font-pitch:fixed; mso-font-signature:3 0 0 0 1 0;} @font-face {font-family:"Book Antiqua"; panose-1:2 4 6 2 5 3 5 3 3 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:647 0 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:white;} a:link, span.MsoHyperlink {color:#3366FF; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:#000066; text-decoration:underline; text-underline:single;} span.SpellE {mso-style-name:""; mso-spl-e:yes;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="63490"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--> </head> <body bgcolor=white lang=EN-US link="#3366FF" vlink="#000066" style='tab-interval: .5in' alink="#ffcc33"> <div class=Section1> <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="95%" style='width:95.58%;mso-cellspacing:0in;mso-padding-alt:7.5pt 7.5pt 7.5pt 7.5pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes'> <td width=1295 valign=top style='width:777.0pt;padding:7.5pt 7.5pt 7.5pt 7.5pt'> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:#333333'><img width=534 height=129 id="_x0000_i1025" src="files/opal_logo.jpg" border=0><o:p></o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-size:22.0pt;font-family:"Book Antiqua";mso-bidi-font-family:Arial; color:black'>Tutorial 7: Event Handlers<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Sensors acquire information from a simulation.<span style='mso-spacerun:yes'> </span>There are several types of Sensors, including Acceleration Sensors, <span class=SpellE>Raycast</span> Sensors, and Volume Sensors.<span style='mso-spacerun:yes'> </span>This tutorial will show how to setup each type.<span style='mso-spacerun:yes'> </span>It will also give examples of how each type could be used.<span style='mso-spacerun:yes'> </span>Keep in mind that a Sensor can either be attached to a Solid or just positioned somewhere in the environment.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Lets first create all the objects well need (and assume they will be initialized elsewhere):<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::Simulator</span></span><span style='font-family:Courier; color:black'>* <span class=SpellE>sim</span> = <span class=SpellE>opal::createSimulator</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::Solid</span></span><span style='font-family:Courier; color:black'>* solid = <span class=SpellE>sim</span>-><span class=SpellE>createSolid</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Acceleration Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The first Sensor we will use here is an Acceleration Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::AccelerationSensorData</span></span><span style='font-family:Courier;color:black'> data;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.solid</span></span><span style='font-family:Courier; color:black'> = solid;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.transform.translate</span></span><span style='font-family: Courier;color:black'>(4, 0, -1);<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::AccelerationSensor</span></span><span style='font-family: Courier;color:black'>* <span class=SpellE>accelSensor</span> = <span class=SpellE>sim</span>-><span class=SpellE>createAccelerationSensor</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>accelSensor</span></span><span style='font-family:Courier; color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Vec3r <span class=SpellE>accel</span> = <span class=SpellE>accelSensor</span>-></span><span class=SpellE><span style='font-size:10.0pt;font-family:"Courier New"; color:windowtext'>getGlobalLinearAccel</span></span><span style='font-size: 10.0pt;font-family:"Courier New";color:windowtext'>();</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Sensor is automatically attached to the Solid if its Solid pointer is set.<span style='mso-spacerun:yes'> </span>It calculates the linear and angular acceleration of the attached Solid at the point of the Sensor (which can be offset from the Solid by using the Sensors transform).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Raycast Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The next Sensor is the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::RaycastSensorData</span></span><span style='font-family: Courier;color:black'> data;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.solid</span></span><span style='font-family:Courier; color:black'> = solid;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.ray.setOrigin</span></span><span style='font-family:Courier; color:black'>(opal::Point3r(0, 0, 0));<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.ray.setDir</span></span><span style='font-family:Courier; color:black'>(opal::Vec3r(0, 0, -1));<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.contactGroup</span></span><span style='font-family:Courier; color:black'> = 2;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::RaycastSensor</span></span><span style='font-family: Courier;color:black'>* <span class=SpellE>raySensor</span> = <span class=SpellE>sim</span>-><span class=SpellE>createRaycastSensor</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>raySensor</span></span><span style='font-family:Courier; color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::RaycastResult</span></span><span style='font-family: Courier;color:black'> result = <span class=SpellE>raySensor</span>-></span><span class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; color:windowtext'>fireRay</span></span><span style='font-family:Courier; mso-bidi-font-family:"Courier New";color:windowtext'>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>opal::Point3r <span class=SpellE>hitPoint</span> = <span class=SpellE>result.intersection</span>;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; mso-bidi-font-family:"Courier New";color:windowtext'>opal::Solid</span></span><span style='font-family:Courier;mso-bidi-font-family:"Courier New";color:windowtext'>* <span class=SpellE>hitSolid</span> = <span class=SpellE>result.solid</span>;</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; color:black'>Raycast</span></span><span style='font-family:"Book Antiqua"; color:black'> Sensors must be fired manually they do not update anything every time step.<span style='mso-spacerun:yes'> </span>When they are fired, they cast a ray into the environment and return data describing the closest point of intersection (if any) from the rays origin.<span style='mso-spacerun:yes'> </span>The <span class=SpellE>Raycast</span> Sensor uses a contact group to limit which objects it collides with.<span style='mso-spacerun:yes'> </span>(See other tutorials for more information on contact groups.)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Volume Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Volume Sensor is similar to the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::VolumeSensorData</span></span><span style='font-family: Courier;color:black'> data;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.contactGroup</span></span><span style='font-family:Courier; color:black'> = 5;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal:: <span class=SpellE>VolumeSensor</span>* <span class=SpellE>volSensor</span> = <span class=SpellE>sim</span>-><span class=SpellE>createVolumeSensor</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>volSensor</span></span><span style='font-family:Courier; color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>// Define a volume Solid.<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::Solid</span></span><span style='font-family:Courier; color:black'>* volume = <span class=SpellE>sim</span>-><span class=SpellE>createSolid</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::SphereShapeData</span></span><span style='font-family: Courier;color:black'> <span class=SpellE>sphereData</span>;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>sphereData.radius</span></span><span style='font-family:Courier; color:black'> = 5;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>volume-><span class=SpellE>addShape</span>(<span class=SpellE>sphereData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::VolumeQueryResult</span></span><span style='font-family: Courier;color:black'> result = <span class=SpellE>volSensor</span>-></span><span class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; color:windowtext'>queryVolume</span></span><span style='font-family:Courier; mso-bidi-font-family:"Courier New";color:windowtext'>(volume);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>for (<span class=SpellE>int</span> <span class=SpellE>i</span>=0; <span class=SpellE>i</span><<span class=SpellE>result.getNumSolids</span>(); ++<span class=SpellE>i</span>)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>{<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>opal::Solid</span>* s = <span class=SpellE>result.getSolid</span>(<span class=SpellE>i</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>opal::Force</span> f;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.type</span> = <span class=SpellE>opal::GLOBAL_FORCE</span>;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.duration</span> = (<span class=SpellE>opal::real</span>)0.05;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.vec</span> = s-><span class=SpellE>getPosition</span>() volume-><span class=SpellE>getPosition</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.vec</span> *= 100;<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span>s-><span class=SpellE>addForce</span>(f);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>}<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Volume Sensors take a volume Solid and query the environment for Solids that collide with the volume Solid.<span style='mso-spacerun:yes'> </span>The resulting data structure contains a list of pointers to those Solids.<span style='mso-spacerun:yes'> </span>Like <span class=SpellE>Raycast</span> Sensors, they can utilize contact groups to limit the set of Solids that are collided with the volume Solid; simply set the contact group of the volume Solid.<span style='mso-spacerun:yes'> </span>They also are not updated every time step; they must be queried manually.<span style='mso-spacerun:yes'> </span>The example above shows how to simulate an explosion: it finds all the Solids within a 5 unit radius from the volumes center and applies an outward force on each object scaled linearly by its distance from the center.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center'><span style='font-size:10.0pt;font-family:"Book Antiqua";mso-bidi-font-family:Arial; color:#333333'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='margin-bottom:12.0pt;text-align:center'><span style='font-size:8.0pt;font-family:"Book Antiqua";mso-bidi-font-family:Arial; color:black'>OPAL is Copyright © 2004-2005 Alan Fischer, Andres Reinot, and Tyler Streeter<o:p></o:p></span></p> </div> </body> </html> --- NEW FILE: tutorial9.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="tutorial9_files/filelist.xml"> <link rel=Edit-Time-Data href="tutorial9_files/editdata.mso"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--> <title>OPAL: Open Physics Abstraction Layer</title> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Author>Tyler Streeter</o:Author> <o:LastAuthor>Tyler Streeter</o:LastAuthor> <o:Revision>176</o:Revision> <o:TotalTime>375</o:TotalTime> <o:Created>2004-06-05T15:20:00Z</o:Created> <o:LastSaved>2005-03-26T17:28:00Z</o:LastSaved> <o:Pages>1</o:Pages> <o:Words>621</o:Words> <o:Characters>3545</o:Characters> <o:Company>none</o:Company> <o:Lines>29</o:Lines> <o:Paragraphs>8</o:Paragraphs> <o:CharactersWithSpaces>4158</o:CharactersWithSpaces> <o:Version>10.6714</o:Version> </o:DocumentProperties> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>90</w:Zoom> <w:SpellingState>Clean</w:SpellingState> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:Courier; panose-1:2 7 4 9 2 2 5 2 4 4; mso-font-charset:0; mso-generic-font-family:modern; mso-font-format:other; mso-font-pitch:fixed; mso-font-signature:3 0 0 0 1 0;} @font-face {font-family:"Book Antiqua"; panose-1:2 4 6 2 5 3 5 3 3 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:647 0 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:white;} a:link, span.MsoHyperlink {color:#3366FF; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:#000066; text-decoration:underline; text-underline:single;} span.SpellE {mso-style-name:""; mso-spl-e:yes;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="64514"> <o:colormenu v:ext="edit" fillcolor="white"/> </o:shapedefaults></xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1"/> </o:shapelayout></xml><![endif]--> </head> <body bgcolor=white lang=EN-US link="#3366FF" vlink="#000066" style='tab-interval: .5in' alink="#ffcc33"> <div class=Section1> <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width="95%" style='width:95.58%;mso-cellspacing:0in;mso-padding-alt:7.5pt 7.5pt 7.5pt 7.5pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes'> <td width=1295 valign=top style='width:777.0pt;padding:7.5pt 7.5pt 7.5pt 7.5pt'> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:#333333'><img width=534 height=129 id="_x0000_i1025" src="files/opal_logo.jpg" border=0><o:p></o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-family:"Book Antiqua";mso-bidi-font-family:Arial;color:black'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><span style='font-size:22.0pt;font-family:"Book Antiqua";mso-bidi-font-family:Arial; color:black'>Tutorial 9: Blueprints and OPAL XML Files<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-family:"Book Antiqua";color:black'>Note:</span></b><span style='font-family:"Book Antiqua";color:black'> See a list of example OPAL XML files at the end of this page.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; color:black'>asdfkasjdnlkasjdnf;lkasdnf</span></span><span style='font-family: "Book Antiqua";color:black'><o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; color:black'>asdf;klnsad;lknsd</span></span><span style='font-family:"Book Antiqua"; color:black'><o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; color:black'>asd;flksandf</span></span><span style='font-family:"Book Antiqua"; color:black'>;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Example OPAL XML <span class=SpellE>Files</span><o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><a href="files/example.xml"><span class=SpellE>example.xml</span></a>: Contains examples of every object type and parameter.<span style='mso-spacerun:yes'> </span>This is to be used as a reference that shows all the available elements and attributes.<span style='mso-spacerun:yes'> </span>It is a valid file that OPAL can load, but it isnt very useful to instantiate.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><a href="files/ragdoll.xml"><span class=SpellE>ragdoll.xml</span></a>: Contains a <span class=SpellE>ragdoll</span> Blueprint of medium complexity.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Sensors acquire information from a simulation.<span style='mso-spacerun:yes'> </span>There are several types of Sensors, including Acceleration Sensors, <span class=SpellE>Raycast</span> Sensors, and Volume Sensors.<span style='mso-spacerun:yes'> </span>This tutorial will show how to setup each type.<span style='mso-spacerun:yes'> </span>It will also give examples of how each type could be used.<span style='mso-spacerun:yes'> </span>Keep in mind that a Sensor can either be attached to a Solid or just positioned somewhere in the environment.<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>Lets first create all the objects well need (and assume they will be initialized elsewhere):<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::Simulator</span></span><span style='font-family:Courier; color:black'>* <span class=SpellE>sim</span> = <span class=SpellE>opal::createSimulator</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::Solid</span></span><span style='font-family:Courier; color:black'>* solid = <span class=SpellE>sim</span>-><span class=SpellE>createSolid</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Acceleration Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The first Sensor we will use here is an Acceleration Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::AccelerationSensorData</span></span><span style='font-family:Courier;color:black'> data;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.solid</span></span><span style='font-family:Courier; color:black'> = solid;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.transform.translate</span></span><span style='font-family: Courier;color:black'>(4, 0, -1);<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::AccelerationSensor</span></span><span style='font-family: Courier;color:black'>* <span class=SpellE>accelSensor</span> = <span class=SpellE>sim</span>-><span class=SpellE>createAccelerationSensor</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>accelSensor</span></span><span style='font-family:Courier; color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal::Vec3r <span class=SpellE>accel</span> = <span class=SpellE>accelSensor</span>-></span><span class=SpellE><span style='font-size:10.0pt;font-family:"Courier New"; color:windowtext'>getGlobalLinearAccel</span></span><span style='font-size: 10.0pt;font-family:"Courier New";color:windowtext'>();</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Sensor is automatically attached to the Solid if its Solid pointer is set.<span style='mso-spacerun:yes'> </span>It calculates the linear and angular acceleration of the attached Solid at the point of the Sensor (which can be offset from the Solid by using the Sensors transform).<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Raycast Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The next Sensor is the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::RaycastSensorData</span></span><span style='font-family: Courier;color:black'> data;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.solid</span></span><span style='font-family:Courier; color:black'> = solid;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.ray.setOrigin</span></span><span style='font-family:Courier; color:black'>(opal::Point3r(0, 0, 0));<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.ray.setDir</span></span><span style='font-family:Courier; color:black'>(opal::Vec3r(0, 0, -1));<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.contactGroup</span></span><span style='font-family:Courier; color:black'> = 2;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::RaycastSensor</span></span><span style='font-family: Courier;color:black'>* <span class=SpellE>raySensor</span> = <span class=SpellE>sim</span>-><span class=SpellE>createRaycastSensor</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>raySensor</span></span><span style='font-family:Courier; color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::RaycastResult</span></span><span style='font-family: Courier;color:black'> result = <span class=SpellE>raySensor</span>-></span><span class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; color:windowtext'>fireRay</span></span><span style='font-family:Courier; mso-bidi-font-family:"Courier New";color:windowtext'>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>opal::Point3r <span class=SpellE>hitPoint</span> = <span class=SpellE>result.intersection</span>;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; mso-bidi-font-family:"Courier New";color:windowtext'>opal::Solid</span></span><span style='font-family:Courier;mso-bidi-font-family:"Courier New";color:windowtext'>* <span class=SpellE>hitSolid</span> = <span class=SpellE>result.solid</span>;</span><span style='font-family:Courier;color:black'><o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> </td> </tr> </table> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:"Book Antiqua"; color:black'>Raycast</span></span><span style='font-family:"Book Antiqua"; color:black'> Sensors must be fired manually they do not update anything every time step.<span style='mso-spacerun:yes'> </span>When they are fired, they cast a ray into the environment and return data describing the closest point of intersection (if any) from the rays origin.<span style='mso-spacerun:yes'> </span>The <span class=SpellE>Raycast</span> Sensor uses a contact group to limit which objects it collides with.<span style='mso-spacerun:yes'> </span>(See other tutorials for more information on contact groups.)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><b style='mso-bidi-font-weight:normal'><span style='font-size:16.0pt;font-family:"Book Antiqua";color:black'>Volume Sensor<o:p></o:p></span></b></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'>The Volume Sensor is similar to the <span class=SpellE>Raycast</span> Sensor:<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:"Book Antiqua";color:black'><o:p> </o:p></span></p> <table class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 align=left style='background:silver;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .25pt;mso-table-lspace:9.0pt;margin-left:.1in;mso-table-rspace: 9.0pt;margin-right:.1in;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal: page;mso-table-left:7.35pt;mso-table-top:12.7pt;mso-padding-alt:0in 5.4pt 0in 5.4pt'> <tr style='mso-yfti-irow:0;mso-yfti-lastrow:yes;height:22.95pt'> <td width=974 valign=top style='width:584.6pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .25pt;padding:0in 5.4pt 0in 5.4pt; height:22.95pt'> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::VolumeSensorData</span></span><span style='font-family: Courier;color:black'> data;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>data.contactGroup</span></span><span style='font-family:Courier; color:black'> = 5;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>opal:: <span class=SpellE>VolumeSensor</span>* <span class=SpellE>volSensor</span> = <span class=SpellE>sim</span>-><span class=SpellE>createVolumeSensor</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>volSensor</span></span><span style='font-family:Courier; color:black'>->init(data);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>// Define a volume Solid.<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::Solid</span></span><span style='font-family:Courier; color:black'>* volume = <span class=SpellE>sim</span>-><span class=SpellE>createSolid</span>();<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::SphereShapeData</span></span><span style='font-family: Courier;color:black'> <span class=SpellE>sphereData</span>;<o:p></o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>sphereData.radius</span></span><span style='font-family:Courier; color:black'> = 5;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>volume-><span class=SpellE>addShape</span>(<span class=SpellE>sphereData</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'>...<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;color:black'><o:p> </o:p></span></p> <p class=MsoNormal><span class=SpellE><span style='font-family:Courier; color:black'>opal::VolumeQueryResult</span></span><span style='font-family: Courier;color:black'> result = <span class=SpellE>volSensor</span>-></span><span class=SpellE><span style='font-family:Courier;mso-bidi-font-family:"Courier New"; color:windowtext'>queryVolume</span></span><span style='font-family:Courier; mso-bidi-font-family:"Courier New";color:windowtext'>(volume);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>for (<span class=SpellE>int</span> <span class=SpellE>i</span>=0; <span class=SpellE>i</span><<span class=SpellE>result.getNumSolids</span>(); ++<span class=SpellE>i</span>)<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'>{<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>opal::Solid</span>* s = <span class=SpellE>result.getSolid</span>(<span class=SpellE>i</span>);<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>opal::Force</span> f;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.type</span> = <span class=SpellE>opal::GLOBAL_FORCE</span>;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.duration</span> = (<span class=SpellE>opal::real</span>)0.05;<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.vec</span> = s-><span class=SpellE>getPosition</span>() volume-><span class=SpellE>getPosition</span>();<o:p></o:p></span></p> <p class=MsoNormal><span style='font-family:Courier;mso-bidi-font-family: "Courier New";color:windowtext'><span style='mso-spacerun:yes'> </span><span class=SpellE>f.vec</span> *= 100;<span style='mso-spacerun:yes'> </span><o:p></o:p></span></p> <p class=MsoNormal><span style='... [truncated message content] |