Jump to content
  • Advertisement
Sign in to follow this  

All came down to this...

This topic is 3773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Couple of Month i didn´t eaven know what a Vector is, but after bying several Math-books and spending more time infront the computer-screen than ever this is my result for my Collision Detection. Just Feed the polygons with Vertexes and Press Play! Im no Carmack and i can asure that lots of girls don´t agree with this but... PROGRAMMING IS THE COOLEST THING ON EARTH!!!! Ps just wanted to tnx all help i got from this forum, gamedev is great! public void exec_CollisionDetection(FPS.types.cDestination objDestination) { exec_LevelWalk(objDestination.GetLevelMoveSpeed()); //Check for Collision < 0.3f units. if (!objCamera.player_is_sliding) { if (objPolygon.PolygonIntersection(objCamera.mPos, 0)) { objCamera.player_is_sliding = true; } } //exec slide_path for Player by using Projected View-Vector. //A small raycast prevents Slide-path from beeing incorrect when hitting walls... if (objCamera.player_is_sliding) { //Destination set by RayCasting destination = Vector3.Normalize(objPolygon.ClosestPointOnPolygon(objPolygon.GetRayCastVector(objCamera.mPos, objCamera.mView, rayCast_length, objDestination)) - objCamera.mPos) * player_slide_speed; //Releast after sliding, also check Corner if (objPolygon.ClosestVertex(objCamera.mPos) > objPolygon.PolygonCornerSpace()) { objCamera.player_is_sliding = objPolygon.NextMovementInsidePolygon(objCamera.mPos, objCamera.mView, rayCast_length, objDestination); } } //Just give Player Normal destination Vector mPos-mView vector. if (!objCamera.player_is_sliding) { destination = objDestination.GetNextFreeMovement(objCamera.mPos, objCamera.mView, player_speed); } //Final destination Point is set, move player. objCamera.MoveCamera(destination); }

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!