Hello,
For a personal project of mine (included in my degree), I would like to create a 3D environment in which entities can walk on the "walls".
Imagine a 3D terrain with a tree in the middle, if the "agent" goes toward the tree and doesn't stop it will walk on it.
If there is a branch, it will walk on it. There is no notion of "up" and "down".
There is no gravity but agents can't "fly", they can just walk.
In fact i would like an implementation close to alien gameplay in Alien Vs Predator (when holding "wall-walk" key).
I've been doing some thinking, for example using a ray below the agent and in front of it to see what triangle it collides with and stick the agent to that triangle but there are too many special cases in which the "next" triangle will not be detected (sharp angles for examples).
Does anyone have any idea or material I could use to implement this ?
I can't find anything on the internet.
I know commercial game developpers don't share their implementations but I was hoping it was tricky enough so that someone had made a paper on it.
Thanks.
Real 3D "wall"-walk like in Avp
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1
Sounds difficult, if not impossible. One cannot walk without gravity. When you walk, gravity pulls you down, your feet push back and you actually fall foward in a controlled manner in order to propel yourself forward. Without gravity, your first step would send you up into the atmosphere and eventually space unless something stopped your movement.There is no gravity but agents can't "fly", they can just walk.
I think in the end any system you came up with to handle this scenario would be nothing but dirty tricks and hacks and probably unwieldy.I've been doing some thinking, for example using a ray below the agent and in front of it to see what triangle it collides with and stick the agent to that triangle but there are too many special cases in which the "next" triangle will not be detected (sharp angles for examples).
I have a similar problem in my game, I want it to take place either on a terrain or in space, and its a FPS and space combat simulator. In space, I would like for 'people' to be able to exist on space stations or capital ships and experience artificial gravity inside the ship, but the direction that gravity exerts should be down from the frame of reference of the ship body (as opposed to straight down for most games). This alone is proving to be quite a challenge I couldn't imagine extending it so that a body could identify any wall at any angle to be 'down'. Good luck getting it to work though...
An interesting topic. Here is something off the top of my head:
Instead of trying to find the next surface, simply take every time one at a time.
First we need to determine how a polygon qualifies as climbable from the current position. Instead of using a line, try using a hemisphere around the agent's feet. We will use this hemisphere to determine if a given polygon X is currently climpable by the agent (he can reach it with his feet).
If there is one or more polygon in the hemi-sphere (or partially in it), find the polygon whose normal is closest to the agent's current up-vector - let's call this polygon A.
Now set the agent's up-vector to the normal of polygon A. Also apply a force opposite of gravity he is unaffected by gravity.
If no polygon was found, the agent must be in open air. Best turn the agent around. Use spherical interpolation (google it to find a formulae) to change the up-vector back to pointing upwards (towards the sky).
It is important that you turn him back to a normal orientation while in the air or he might land on his head. If he is upside down on the ground, the hemi-sphere enclosing his feet will not touch the ground and he will be stuck like that forever.
Instead of trying to find the next surface, simply take every time one at a time.
First we need to determine how a polygon qualifies as climbable from the current position. Instead of using a line, try using a hemisphere around the agent's feet. We will use this hemisphere to determine if a given polygon X is currently climpable by the agent (he can reach it with his feet).
If there is one or more polygon in the hemi-sphere (or partially in it), find the polygon whose normal is closest to the agent's current up-vector - let's call this polygon A.
Now set the agent's up-vector to the normal of polygon A. Also apply a force opposite of gravity he is unaffected by gravity.
If no polygon was found, the agent must be in open air. Best turn the agent around. Use spherical interpolation (google it to find a formulae) to change the up-vector back to pointing upwards (towards the sky).
It is important that you turn him back to a normal orientation while in the air or he might land on his head. If he is upside down on the ground, the hemi-sphere enclosing his feet will not touch the ground and he will be stuck like that forever.
-
- Posts: 322
- Joined: Tue Aug 30, 2005 10:34 am
- Location: slovakia
Thanks Klasker for your answer.
Let me show you an example :
The agent is moving ON face 1 in "forward" direction.
Both my ray (in down direction) and your hemisphere won't detect face 2.
Shouldn't have mentionned gravity because in wall walk there is absolutely no external force applied to the agent which is really glued to the surface.
For those who have played AVP you know how the view make us sick when the alien is moving on surfaces with high angle changes. I want my agents to perform the same way.
The term "walk" is important here. The agent doens't move in the environnement "encountering" surfaces, it can only slide on surfaces and never be in middle air.
Let me show you an example :
The agent is moving ON face 1 in "forward" direction.
Both my ray (in down direction) and your hemisphere won't detect face 2.
Shouldn't have mentionned gravity because in wall walk there is absolutely no external force applied to the agent which is really glued to the surface.
For those who have played AVP you know how the view make us sick when the alien is moving on surfaces with high angle changes. I want my agents to perform the same way.
The term "walk" is important here. The agent doens't move in the environnement "encountering" surfaces, it can only slide on surfaces and never be in middle air.
Hm... another try.
Find the closest point on the polygon.. let's call it P.
Call the center of the agent C.
Now set the up vector parrallel to vector(C-P).
When he encounters a corner, he will move his center when moving, so even if the closest point remains the same after moving his up vector will be changed.
These two sketches should illustrate the idea:
Blunt angles pose another problem though.. Maybe if you slightly lowered the agent's center so it isn't his true center but when he switch walls he will stay on the wall he just switched to so we doesn't jump back and forth.
Find the closest point on the polygon.. let's call it P.
Call the center of the agent C.
Now set the up vector parrallel to vector(C-P).
When he encounters a corner, he will move his center when moving, so even if the closest point remains the same after moving his up vector will be changed.
These two sketches should illustrate the idea:
Blunt angles pose another problem though.. Maybe if you slightly lowered the agent's center so it isn't his true center but when he switch walls he will stay on the wall he just switched to so we doesn't jump back and forth.