30 #include <OgrePlane.h> 32 #include <OgreSceneNode.h> 33 #include <OgreViewport.h> 66 setStatus(
"Click and drag mouse to set position/orientation." );
83 Ogre::Vector3 intersection;
84 Ogre::Plane ground_plane( Ogre::Vector3::UNIT_Z, 0.0
f );
87 event.
x, event.
y, intersection ))
96 else if( event.
type == QEvent::MouseMove && event.
left() )
101 Ogre::Vector3 cur_pos;
102 Ogre::Plane ground_plane( Ogre::Vector3::UNIT_Z, 0.0
f );
105 event.
x, event.
y, cur_pos ))
107 double angle = atan2( cur_pos.y -
pos_.y, cur_pos.x -
pos_.x );
112 Ogre::Quaternion orient_x = Ogre::Quaternion( Ogre::Radian(-Ogre::Math::HALF_PI), Ogre::Vector3::UNIT_Y );
114 arrow_->
setOrientation( Ogre::Quaternion( Ogre::Radian(angle), Ogre::Vector3::UNIT_Z ) * orient_x );
125 Ogre::Vector3 cur_pos;
126 Ogre::Plane ground_plane( Ogre::Vector3::UNIT_Z, 0.0
f );
129 event.
x, event.
y, cur_pos ))
131 double angle = atan2( cur_pos.y -
pos_.y, cur_pos.x -
pos_.x );
Ogre::Viewport * viewport
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
Ogre::SceneNode * getSceneNode()
Get the scene node associated with this arrow.
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of the base of the arrow.
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].
virtual void setOrientation(const Ogre::Quaternion &orientation)
Set the orientation.
bool getPointOnPlaneFromWindowXY(Ogre::Viewport *viewport, Ogre::Plane &plane, int window_x, int window_y, Ogre::Vector3 &intersection_out)
Given a viewport and an x,y position in window-pixel coordinates, find the point on a plane directly ...
An arrow consisting of a cylinder and a cone.