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
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 8 |
bool CCharacter::GroundCollision(CObject* pObject) { if (!(Model || pObject)) return false; return tbModelHitsModel( CollisionModel, GetMatrix(), tbMatrixInvert(GetMatrix()), pObject->CollisionModel, pObject->GetMatrix(), tbMatrixInvert(pObject->GetMatrix())); } |
C-/C++-Quelltext |
|
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 34 |
// h-Datei class CObject { protected: tbMatrix RotationMatrix; public: CObject(); virtual ~CObject(); tbModel* Model; tbModel* CollisionModel; tbVector3 Position; tbVector3 Direction; virtual tbMatrix GetMatrix() { return RotationMatrix* tbMatrixTranslation(Position); } virtual tbResult LoadModel(char* pFileName, char* pPrefix = NULL, char* pPostfix = NULL); virtual void Render(); virtual void Move(float fNumSecsPassed); virtual void RotateY(float pAngle); // verschiedene Methoden wie GetWidth()... }; // cpp-Datei void CObject::RotateY(float pAngle) { tbMatrix mRotate = tbMatrixRotationY(pAngle); Direction = tbVector3Normalize( tbVector3(tbMatrix(Direction)*mRotate) ); RotationMatrix *= mRotate; } |
C-/C++-Quelltext |
|
1 2 3 4 5 6 7 |
void CCharacter::Move(float fNumSecsPassed) { ... if (CGame::Instance().Objects[ i ] && GroundCollision(CGame::Instance().Objects[ i ])) IsJumping = false; ... } |
Treue Seele
Werbeanzeige