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
Quellcode |
|
1 2 3 |
// only activate the yaw rudder if the roll angle is above 5 degrees if( fabsf( rollAngle ) > 5.0f ) _currentTorque.Y += -cosf( rollAngle * core::DEGTORAD ) * rollDamping * _maxYawThrust; |
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
// Das hier nur mal als Info: // _currentMoveAcceleration ist der Bewegungsvektor (gesetzt vom Controller) // typischerweise hat er folgendes Aussehen (Kraft wirkt in Z-Richtung, also nach vorn): // core::vector3df( 0.0f, 0.0f, thrust ) // // _currentTorqueAcceleration beinhaltet dann die Drehbewegungen in den entsprechenden Achsen // (ebenfalls vom Controller gesetzt) core::matrix4 rotMatrix; rotMatrix.setRotationDegrees( _rotation ); // transform the current ship acceleration to the ship's coordinate system rotMatrix.transformVect( _currentMoveAcceleration ); force.X = mass * _currentMoveAcceleration.X * timestep; force.Y = mass * _currentMoveAcceleration.Y * timestep; force.Z = mass * _currentMoveAcceleration.Z * timestep; // compute the current roll angle core::vector3df rollVectorX = core::vector3df( 1.0f, 0.0f, 0.0f ); rotMatrix.transformVect( rollVectorX ); core::vector3df rollVectorY = core::vector3df( 0.0f, 1.0f, 0.0f ); rotMatrix.transformVect( rollVectorY ); float rollAngle = atan2f( rollVectorX.Y, rollVectorY.Y ) * core::RADTODEG; // transform the new torque values to the ship's coordinate system rotMatrix.transformVect( _currentTorqueAcceleration ); // only activate the yaw rudder if the roll angle is above 5 degrees if( fabsf( rollAngle ) > 5.0f ) _currentTorqueAcceleration.Y += -cosf( rollAngle * core::DEGTORAD ) * rollDamping * _maxYawThrust; // force = mass * acceleration ;-) torque = _currentTorqueAcceleration * mass * timestep; |
Alter Hase
Zitat von »"bassdscho"«
die netzgitter ansicht ist geil
Werbeanzeige