Rotating a world, collision detection?

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

Recommended Posts

Hi, I've made some sort of game which works pretty much like a FPS when it comes to viewing and collision detection. Normally the world is static so while loading, it puts all the world polygons into a 2D raster so the player only has to check nearby polygons for exact collisions. So far so good, but now we want to do something unusual with this world... Imagine a large halfpipe shaped world. When you walk towards the vertical wall, either the world or the player has to rotate as if you were still walking straight forward. So basically you walk upun that vertical wall without really noticing it, as if you have glue under your shoes and the gravity direction has changed. I hope you can still understand it, its hard to explain for me :) Now howto do this? I can think of 2 ways: - Rotate the camera, change the gravity direction. Sounds easy, but the physics are quite dumb in the game. - Rotate the entire world(not the player). But now the 2D grid with the polygons for the collision detection doesn't match with the actual model of course. Has anyone experience with these kind of weird effects? Greetings, Rick

Share on other sites
Sounds interesting!

I haven't made non-uniform gravity myself, but was always thinking it might be fun....

the closest thing I've seen to this in commercial games is...
That Matrix game, where you can walk on walls
and Aliens Vs Predator, where the Alien can climb everywhere as if there was no gravity (till you jump that is)

The way both of those worked as far as I know, is that you just align the players 'Up' orientation to whatever polygon normal you are standing on, and turn off gravity as long as he is touching that polygon. then just lerp between polygon normals as you cross from one to the next.

But maybe you want to do more than this? for example are you thinking of having a world inside a spinning cylindrical space station? where gravity would vary continously based on your 3d position, not just the current floor you're standing on? The final level in Lander(Psygnosis) had rooms like this, as far as I can tell they used some sort of 3d vector field functions to define gravity that changes based on location. Hardly easy to arbitrarially define in your map editor...

How about a system of invisible Attractor and Repulsor objects that you could place into your map? and define weights for averaging them so they have different local area's of effect? The only problem I see with this is the number of calculations required to find current gravity...

As for your collision detection issues....
You don't have too much detail about exactly how yours works....
But I'd say that if you want a world that can re-orient in 3d... maybe its time to think about 3d collision detection?

Share on other sites
Alien vs Predator, that's a good example indeed. Using the normals is a good idea. Instead of physics with gracity, I need to build some 'glue on my shoes' instead. Thanks for the tips!

That probably brings me to the next question, proper collision detection. Like I mentioned before, the world is divided into a 2D raster. Each cell has a list of polygons that are inside that place or overlap them. I could also use a 3D grid but as the world doesn't really have multiple stores, I saved some memory by just using a 2D grid. Anyway, when you walk around, the current cell(s) you overlap are calculated. Now you can do collision detection with the nearby polygons.

The question is, how do FPS games do this? I would say the player model as a cylinder-shaped collision hull around. But howto perform cylinder-vs-polygon detection? Or maybe there's a much better way. I also need a good reaction once you collide. Now it detects collisions with sphere-vs-polygon with a function like this:
bool collisionCheck( vector3f myPosition, float myRadius );
If it returns true, your position is reset to the previous one so you can't move. But that's not really smooth, you keep hanging behind walls and stuff.

Greetings,
Rick

[Edited by - spek on December 6, 2005 6:12:38 PM]

Share on other sites
"Serious Sam: The Second Encounter" by CroTeam had something like what you describe - there is actually an area where the room is cylindrical and you can walk all the way around, and monsters can do likewise. It was an awesome experience =-)

Personally, I think the best thing to do would be to change your data structures - a 2d grid (which is what I think you mean by 'raster') isn't well suited to a fully 3D 6 DoF (degrees of freedom - 3 axis for translation, 3 axis for rotation) world.

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• Forum Statistics

• Total Topics
632988
• Total Posts
3009736
• Who's Online (See full list)

There are no registered users currently online

×