mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 11:13:09 +02:00
don’t render toy ball if hand controller trigger not pressed at all
This commit is contained in:
parent
2d30bf0d93
commit
305a75c2b7
2 changed files with 7 additions and 1 deletions
|
@ -42,6 +42,7 @@ Hand::Hand(Avatar* owningAvatar) :
|
||||||
_toyBallVelocity(0),
|
_toyBallVelocity(0),
|
||||||
_toyBallInHand(false),
|
_toyBallInHand(false),
|
||||||
_hasToyBall(false),
|
_hasToyBall(false),
|
||||||
|
_toyBallShouldRender(false),
|
||||||
_ballParticleEditHandle(NULL),
|
_ballParticleEditHandle(NULL),
|
||||||
_pitchUpdate(0)
|
_pitchUpdate(0)
|
||||||
{
|
{
|
||||||
|
@ -61,9 +62,11 @@ void Hand::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, float deltaTime) {
|
void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, float deltaTime) {
|
||||||
|
|
||||||
// Is the controller button being held down....
|
// Is the controller button being held down....
|
||||||
if (palm.getControllerButtons() & BUTTON_FWD) {
|
if (palm.getControllerButtons() & BUTTON_FWD) {
|
||||||
// If grabbing toy ball, add forces to it.
|
// If grabbing toy ball, add forces to it.
|
||||||
|
_toyBallShouldRender = true;
|
||||||
|
|
||||||
// If we don't currently have a ball in hand, then create it...
|
// If we don't currently have a ball in hand, then create it...
|
||||||
if (!_toyBallInHand) {
|
if (!_toyBallInHand) {
|
||||||
|
@ -357,7 +360,8 @@ void Hand::render( bool isMine) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render toy ball
|
// Render toy ball
|
||||||
if (isMine) {
|
|
||||||
|
if (isMine && _toyBallShouldRender) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glColor3f(1, 0, 0);
|
glColor3f(1, 0, 0);
|
||||||
glTranslatef(_toyBallPosition.x, _toyBallPosition.y, _toyBallPosition.z);
|
glTranslatef(_toyBallPosition.x, _toyBallPosition.y, _toyBallPosition.z);
|
||||||
|
|
|
@ -100,6 +100,8 @@ private:
|
||||||
glm::vec3 _toyBallVelocity;
|
glm::vec3 _toyBallVelocity;
|
||||||
bool _toyBallInHand;
|
bool _toyBallInHand;
|
||||||
bool _hasToyBall;
|
bool _hasToyBall;
|
||||||
|
bool _toyBallShouldRender;
|
||||||
|
|
||||||
ParticleEditHandle* _ballParticleEditHandle;
|
ParticleEditHandle* _ballParticleEditHandle;
|
||||||
|
|
||||||
float _pitchUpdate;
|
float _pitchUpdate;
|
||||||
|
|
Loading…
Reference in a new issue