mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 07:17:43 +02:00
fix crash, and remove gravity while in hand
This commit is contained in:
parent
50b93d1e2b
commit
d3197ef8f9
4 changed files with 12 additions and 3 deletions
|
@ -2815,8 +2815,11 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node
|
||||||
|
|
||||||
int packetLength = endOfVoxelQueryPacket - voxelQueryPacket;
|
int packetLength = endOfVoxelQueryPacket - voxelQueryPacket;
|
||||||
|
|
||||||
|
// make sure we still have an active socket
|
||||||
|
if (node->getActiveSocket()) {
|
||||||
nodeList->getNodeSocket().writeDatagram((char*) voxelQueryPacket, packetLength,
|
nodeList->getNodeSocket().writeDatagram((char*) voxelQueryPacket, packetLength,
|
||||||
node->getActiveSocket()->getAddress(), node->getActiveSocket()->getPort());
|
node->getActiveSocket()->getAddress(), node->getActiveSocket()->getPort());
|
||||||
|
}
|
||||||
|
|
||||||
// Feed number of bytes to corresponding channel of the bandwidth meter
|
// Feed number of bytes to corresponding channel of the bandwidth meter
|
||||||
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);
|
_bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);
|
||||||
|
|
|
@ -23,6 +23,7 @@ const float FINGERTIP_VOXEL_SIZE = 0.05;
|
||||||
const int TOY_BALL_HAND = 1;
|
const int TOY_BALL_HAND = 1;
|
||||||
const float TOY_BALL_RADIUS = 0.05f;
|
const float TOY_BALL_RADIUS = 0.05f;
|
||||||
const float TOY_BALL_DAMPING = 0.99f;
|
const float TOY_BALL_DAMPING = 0.99f;
|
||||||
|
const glm::vec3 NO_GRAVITY = glm::vec3(0,0,0);
|
||||||
const glm::vec3 TOY_BALL_GRAVITY = glm::vec3(0,-1,0);
|
const glm::vec3 TOY_BALL_GRAVITY = glm::vec3(0,-1,0);
|
||||||
const QString TOY_BALL_UPDATE_SCRIPT("");
|
const QString TOY_BALL_UPDATE_SCRIPT("");
|
||||||
const QString TOY_BALL_DONT_DIE_SCRIPT("Particle.setShouldDie(false);");
|
const QString TOY_BALL_DONT_DIE_SCRIPT("Particle.setShouldDie(false);");
|
||||||
|
@ -101,7 +102,7 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f
|
||||||
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
||||||
TOY_BALL_ON_SERVER_COLOR,
|
TOY_BALL_ON_SERVER_COLOR,
|
||||||
_toyBallVelocity / (float)TREE_SCALE,
|
_toyBallVelocity / (float)TREE_SCALE,
|
||||||
TOY_BALL_GRAVITY / (float) TREE_SCALE,
|
NO_GRAVITY / (float) TREE_SCALE,
|
||||||
TOY_BALL_DAMPING,
|
TOY_BALL_DAMPING,
|
||||||
TOY_BALL_DONT_DIE_SCRIPT);
|
TOY_BALL_DONT_DIE_SCRIPT);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +116,7 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f
|
||||||
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
||||||
TOY_BALL_ON_SERVER_COLOR,
|
TOY_BALL_ON_SERVER_COLOR,
|
||||||
_toyBallVelocity / (float)TREE_SCALE,
|
_toyBallVelocity / (float)TREE_SCALE,
|
||||||
TOY_BALL_GRAVITY / (float) TREE_SCALE,
|
NO_GRAVITY / (float) TREE_SCALE,
|
||||||
TOY_BALL_DAMPING,
|
TOY_BALL_DAMPING,
|
||||||
TOY_BALL_DONT_DIE_SCRIPT);
|
TOY_BALL_DONT_DIE_SCRIPT);
|
||||||
}
|
}
|
||||||
|
@ -130,6 +131,7 @@ void Hand::simulateToyBall(PalmData& palm, const glm::vec3& fingerTipPosition, f
|
||||||
//printVector(avatarRotation * handVelocity);
|
//printVector(avatarRotation * handVelocity);
|
||||||
_toyBallVelocity += avatarRotation * fingerTipVelocity;
|
_toyBallVelocity += avatarRotation * fingerTipVelocity;
|
||||||
|
|
||||||
|
// ball is no longer in hand...
|
||||||
_ballParticleEditHandle->updateParticle(fingerTipPosition / (float)TREE_SCALE,
|
_ballParticleEditHandle->updateParticle(fingerTipPosition / (float)TREE_SCALE,
|
||||||
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
TOY_BALL_RADIUS / (float) TREE_SCALE,
|
||||||
TOY_BALL_ON_SERVER_COLOR,
|
TOY_BALL_ON_SERVER_COLOR,
|
||||||
|
|
|
@ -249,6 +249,9 @@ Particle Particle::fromEditPacket(unsigned char* data, int length, int& processe
|
||||||
void Particle::debugDump() const {
|
void Particle::debugDump() const {
|
||||||
printf("Particle id :%u\n", _id);
|
printf("Particle id :%u\n", _id);
|
||||||
printf(" last updated:%llu\n", _lastUpdated);
|
printf(" last updated:%llu\n", _lastUpdated);
|
||||||
|
printf(" position:%f,%f,%f\n", _position.x, _position.y, _position.z);
|
||||||
|
printf(" velocity:%f,%f,%f\n", _velocity.x, _velocity.y, _velocity.z);
|
||||||
|
printf(" gravity:%f,%f,%f\n", _gravity.x, _gravity.y, _gravity.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Particle::encodeParticleEditMessageDetails(PACKET_TYPE command, int count, const ParticleDetail* details,
|
bool Particle::encodeParticleEditMessageDetails(PACKET_TYPE command, int count, const ParticleDetail* details,
|
||||||
|
|
|
@ -65,6 +65,7 @@ void ParticleTreeElement::update(ParticleTreeUpdateArgs& args) {
|
||||||
|
|
||||||
// update our contained particles
|
// update our contained particles
|
||||||
uint16_t numberOfParticles = _particles.size();
|
uint16_t numberOfParticles = _particles.size();
|
||||||
|
|
||||||
for (uint16_t i = 0; i < numberOfParticles; i++) {
|
for (uint16_t i = 0; i < numberOfParticles; i++) {
|
||||||
_particles[i].update();
|
_particles[i].update();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue