Sign in to follow this  

All came down to this...

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this