Collision Detection problem
Hello Everyone. I have a question about scaling models. I am implementing collision in my 3d maze game. I orginally created all models the same size. The only models in my game are cubes (including the player) and fla plains for the floor and ceiling. All models have the same scaling when I modeled them. However I want the player to be smaller than the walls and floor. So I scaled the walls and floors by Vector3(5,5,5)
From the bottom to the top of one floor plain mesh, it is 0 to 1.
For example
(0,1)__________(1,1)
| |
| |
| |
| |
(0,0)----------(0,1)
However the player is smaller than the floor mesh tile. I draw hundreds of floor mesh tiles to draw the level's floor if that makes since.
When a player moves within a floor tile, he starts at (0,0) but when he gets to the top left corner, he is at (0,5) instead of (0,1) because I scaled the floor tiles and walls as I mentioned earlier. I want his x and y values to appear as (0,1) and not (0,5) so that collision will be easier to do. I made a ratio function that would convert the player's real position to a coordinate that would match that of the rest of the world. Unfortunately, using a ratio gets messy because it is a fraction and collision will not be very accurate in a very large maze.
Any ideas on how I can make the world and player's position be in the same coordinate system?
Thanks in advance!
GOD Bless you Always!!!
I want the player to be smaller than the walls and the floor. If he is the same size, he will be a giant in the world.
Quote:Original post by BlackDragon777
I made a ratio function that would convert the player's real position to a coordinate that would match that of the rest of the world. Unfortunately, using a ratio gets messy because it is a fraction and collision will not be very accurate in a very large maze.
What makes you think this is going to be inaccurate? It sounds ok to me, the scale converter is going to be constant regardless of how big the map is.
Are your objects and player coordinates measured in Integers or something, and you dont want to involve floats in calculations?
I'm not seeing an issue here... maybe I don't get the whole picture
PS if you dont like fractions (ratio less that 1??) then why not invert it, use the other coordinate system, and do a multiply instead of divide.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement