Skip to main content
gamedev.net
🔒 Locked

stuff

Started by hello_there Jul 16, 2003 at 6:39 AM 2 replies 350+ views
Original Post
hello_there
hello_there
in my 3d tile based game i have collision detection thing set up so i know when the player collides with an object. but i can''t think of a good fast reliable way of moving the player back to the right position. it musn''t be that hard to do. can someone help?
____________How could hell be worse?
krez
krez
nice descriptive thread title you got there

anyway, is it tile-based movement (like old console RPGs), or smooth movement?

if it is tile-based, just save the last position the player was at and move them back there.

if it is smooth movement, where the player can be partially in more than one tile, it depends on how you do the colission detection.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
hello_there
hello_there
it''s smooth movement. the collision detection just checks to see if the players cube is coliding with the walls cube
____________How could hell be worse?
Vich
Vich
Do this:

- find the 2D vector that is made by the player''s start point an his collision point
- push the player back along the negative value of this vector, until he doesn''t collide anymore

This can off course also be applied in 3D.

Happy coding!

"My basic needs in life are food, love and a C++ compiler"
[Project AlterNova] [Novanet]
[www.LifeIsDigital.net - My open source projects and articles.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.