33 #include <OgreSceneManager.h> 34 #include <OgreSceneNode.h> 35 #include <OgreVector3.h> 36 #include <OgreQuaternion.h> 43 Arrow::Arrow( Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node,
float shaft_length,
float shaft_diameter,
44 float head_length,
float head_diameter )
58 set( shaft_length, shaft_diameter, head_length, head_diameter );
71 void Arrow::set(
float shaft_length,
float shaft_diameter,
float head_length,
float head_diameter )
73 shaft_->
setScale(Ogre::Vector3(shaft_diameter, shaft_length, shaft_diameter));
76 head_->
setScale( Ogre::Vector3( head_diameter, head_length, head_diameter ) );
88 setColor(Ogre::ColourValue(r, g, b, a));
120 scene_node_->setOrientation( orientation * Ogre::Quaternion( Ogre::Degree( -90 ), Ogre::Vector3::UNIT_X ) );
125 if( !direction.isZeroLength() )
127 setOrientation( Ogre::Vector3::NEGATIVE_UNIT_Z.getRotationTo( direction ));
134 scene_node_->setScale( Ogre::Vector3( scale.z, scale.x, scale.y ) );
Ogre::SceneNode * scene_node_
virtual const Ogre::Vector3 & getPosition()
Get the local position of this object.
void setUserData(const Ogre::Any &data)
Sets user data on all ogre objects we own.
void setDirection(const Ogre::Vector3 &direction)
Set the direction of the arrow.
void set(float shaft_length, float shaft_diameter, float head_length, float head_diameter)
Set the parameters for this arrow.
virtual void setColor(float r, float g, float b, float a)
Set the color of the object. Values are in the range [0, 1].
Base class for visible objects, providing a minimal generic interface.
void setUserData(const Ogre::Any &data)
Sets user data on all ogre objects we own.
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of the base of the arrow.
virtual void setScale(const Ogre::Vector3 &scale)
Set the scale of the object. Always relative to the identity orientation of the object.
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of this object.
Arrow(Ogre::SceneManager *scene_manager, Ogre::SceneNode *parent_node=0, float shaft_length=1.0f, float shaft_diameter=0.1f, float head_length=0.3f, float head_diameter=0.2f)
Constructor.
virtual const Ogre::Quaternion & getOrientation()
Get the local orientation of this object.
virtual void setColor(float r, float g, float b, float a)
Set the color of this arrow. Sets both the head and shaft color to the same value. Values are in the range [0, 1].
Shape * head_
Cone used for the head of the arrow.
virtual void setOrientation(const Ogre::Quaternion &orientation)
Set the orientation.
void setShaftColor(float r, float g, float b, float a=1.0f)
Set the color of the arrow's shaft. Values are in the range [0, 1].
Ogre::SceneManager * scene_manager_
Ogre scene manager this object is part of.
void setOffset(const Ogre::Vector3 &offset)
Set the offset for this shape.
void setHeadColor(float r, float g, float b, float a=1.0f)
Set the color of the arrow's head. Values are in the range [0, 1].
virtual void setScale(const Ogre::Vector3 &scale)
Set the scale of the object. Always relative to the identity orientation of the object.
Shape * shaft_
Cylinder used for the shaft of the arrow.