mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Hair gravity always the same
This commit is contained in:
parent
ab557447f2
commit
d5d0fbd9d8
4 changed files with 5 additions and 7 deletions
|
@ -38,7 +38,7 @@ Hair::Hair(int strands,
|
|||
_acceleration(0.0f),
|
||||
_angularVelocity(0.0f),
|
||||
_angularAcceleration(0.0f),
|
||||
_gravity(0.0f),
|
||||
_gravity(DEFAULT_GRAVITY),
|
||||
_loudness(0.0f)
|
||||
{
|
||||
_hairPosition = new glm::vec3[_strands * _links];
|
||||
|
@ -53,7 +53,7 @@ Hair::Hair(int strands,
|
|||
for (int strand = 0; strand < _strands; strand++) {
|
||||
float strandAngle = randFloat() * PI;
|
||||
float azimuth;
|
||||
float elevation = PI_OVER_TWO - (randFloat() * 0.10f * PI);
|
||||
float elevation = - (randFloat() * PI);
|
||||
azimuth = PI_OVER_TWO;
|
||||
if (randFloat() < 0.5f) {
|
||||
azimuth *= -1.0f;
|
||||
|
@ -127,7 +127,7 @@ void Hair::simulate(float deltaTime) {
|
|||
_hairPosition[vertexIndex] += randVector() * (QUIESCENT_LOUDNESS + loudnessFactor) * ((float)link / (float)_links);
|
||||
|
||||
// Add gravity
|
||||
const float SCALE_GRAVITY = 0.13f;
|
||||
const float SCALE_GRAVITY = 0.001f;
|
||||
_hairPosition[vertexIndex] += _gravity * deltaTime * SCALE_GRAVITY;
|
||||
|
||||
// Add linear acceleration
|
||||
|
|
|
@ -25,9 +25,10 @@ const int HAIR_CONSTRAINTS = 2;
|
|||
|
||||
const int DEFAULT_HAIR_STRANDS = 20;
|
||||
const int DEFAULT_HAIR_LINKS = 10;
|
||||
const float DEFAULT_HAIR_RADIUS = 0.15f;
|
||||
const float DEFAULT_HAIR_RADIUS = 0.075f;
|
||||
const float DEFAULT_HAIR_LINK_LENGTH = 0.06f;
|
||||
const float DEFAULT_HAIR_THICKNESS = 0.025f;
|
||||
const glm::vec3 DEFAULT_GRAVITY(0.0f, -9.8f, 0.0f);
|
||||
|
||||
class Hair {
|
||||
public:
|
||||
|
@ -41,7 +42,6 @@ public:
|
|||
void setAcceleration(const glm::vec3& acceleration) { _acceleration = acceleration; }
|
||||
void setAngularVelocity(const glm::vec3& angularVelocity) { _angularVelocity = angularVelocity; }
|
||||
void setAngularAcceleration(const glm::vec3& angularAcceleration) { _angularAcceleration = angularAcceleration; }
|
||||
void setGravity(const glm::vec3& gravity) { _gravity = gravity; }
|
||||
void setLoudness(const float loudness) { _loudness = loudness; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -191,7 +191,6 @@ void Avatar::simulate(float deltaTime) {
|
|||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setLoudness((float) getHeadData()->getAudioLoudness());
|
||||
_hair.simulate(deltaTime);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,6 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
_hair.setAcceleration(getAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularVelocity((getAngularVelocity() + getHead()->getAngularVelocity()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setAngularAcceleration(getAngularAcceleration() * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setGravity(Application::getInstance()->getEnvironment()->getGravity(getPosition()) * getHead()->getFinalOrientationInWorldFrame());
|
||||
_hair.setLoudness((float)getHeadData()->getAudioLoudness());
|
||||
_hair.simulate(deltaTime);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue