Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
(Link)
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 |
//... for (int x = 0; x < 4; x++) { eigenverschiebung.X += ((sin(degToRad(NormalizeAngle(this->mShipHeading + _podThrusterRotation[x]))) * (timeMs * this->mShipVelocity)) * _podThrusterSpeed[x]); eigenverschiebung.Z += ((cos(degToRad(NormalizeAngle(this->mShipHeading + _podThrusterRotation[x]))) * (timeMs * this->mShipVelocity)) * _podThrusterSpeed[x]); } //... |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
if (_targetAngle != this->mShipHeading) { if (this->mShipHeading < _targetAngle) { this->mShipHeading += (_rotationSpeed * max_<float>(this->mShipVelocity, 0.01f)); this->mShipHeading = min_<float>(this->mShipHeading, _targetAngle); } else if (this->mShipHeading > _targetAngle) { this->mShipHeading -= (_rotationSpeed * max_<float>(this->mShipVelocity, 0.01f)); this->mShipHeading = max_<float>(this->mShipHeading, _targetAngle); } } |
Zitat
Wenn ich das richtig sehe, geht die relative Position der Pods am Schiff garnicht in die Rechnungen mit ein, oder?
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
/// numOfPods = 4 vector3df _forward = ((_podInfo[0].mForward + _podInfo[1].mForward + _podInfo[2].mForward + _podInfo[3].mForward) / (float)numOfPods); float _angle = 90.f; float _a0 = ((_podInfo[0].mDir.X * _angle) * ((_podInfo[0].mCP.Z < 0.f) ? -1.f : 1.f) * _podInfo[0].mPodThrusterSpeed); float _a1 = ((_podInfo[2].mDir.X * _angle) * ((_podInfo[2].mCP.Z < 0.f) ? -1.f : 1.f) * _podInfo[2].mPodThrusterSpeed); float _a2 = ((_podInfo[1].mDir.X * _angle) * ((_podInfo[1].mCP.Z < 0.f) ? -1.f : 1.f) * _podInfo[1].mPodThrusterSpeed); float _a3 = ((_podInfo[3].mDir.X * _angle) * ((_podInfo[3].mCP.Z < 0.f) ? -1.f : 1.f) * _podInfo[3].mPodThrusterSpeed); /// Dieser Teil berechnet den korrigier Winkel wenn nur auf Steuer- oder Backbord Schub vorhanden ist. /// Dies führt dazu dass das Schiff mit der Zeit eine drehung macht. float _ca0 = ((_podInfo[0].mDir.Y * _angle) * ((_podInfo[0].mCP.X < 0.f) ? -1.f : 1.f) * _podInfo[0].mPodThrusterSpeed); float _ca1 = ((_podInfo[1].mDir.Y * _angle) * ((_podInfo[1].mCP.X < 0.f) ? -1.f : 1.f) * _podInfo[1].mPodThrusterSpeed); float _ca2 = ((_podInfo[2].mDir.Y * _angle) * ((_podInfo[2].mCP.X < 0.f) ? -1.f : 1.f) * _podInfo[2].mPodThrusterSpeed); float _ca3 = ((_podInfo[3].mDir.Y * _angle) * ((_podInfo[3].mCP.X < 0.f) ? -1.f : 1.f) * _podInfo[3].mPodThrusterSpeed); float _ca = ((_ca0 + _ca1) + (_ca2 + _ca3)) * _forward.Z; float _targetAngle = (((_a0 + _a1) + (_a2 + _a3)) + _ca); |
Zitat
Ich würde nach meinen Kenntnisstand aus klassischer Mechanik darauf tippen, dass man kaum darum kommt Drehmomente und Translationskräfte entsprechend zu berücksichtigen.
Zitat
P.S. wie "realistisch" muss denn das Ergebnis sein?
Zitat
P.P.S. Richtungsvektor und Drehwinkel in Grad erscheinen mir redundant, oder was genau ist mit dem Richtungsvektor gemeint?
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »Garfield83« (15.07.2018, 11:26)
Werbeanzeige