3D combat surface walking
Post Reply
Quote
Re: 3D combat surface walking
Posted by Stadric on Sat Jun 9th at 3:58am 2007


Makes sense, I was thinking that, but I wasn't entirely sure because I hate rotational motion.


Also change the texture of the dock. Docks are rarely tile. -Facepunch
As I Lay Dying



Quote
Re: 3D combat surface walking
Posted by Naklajat on Sat Jun 9th at 4:15am 2007


? quote:
F = ma
T(torque, not the period) = F/r

g=G(m1)(m2)/d2, G = 6.67*10^-11 (m3)/kg(s2)

And that's all you need to know!

tl;dr :P

I like the idea of fighting across part of an asteroid belt or the wreckage of a spaceship though. A potential problem for using accurate calculations would certainly be the fact that you need a lot of mass to have gravity substantial enough to hold a person on the ground. UE3 has gravity volumes, I made a roboblitz test map where you can drive on the walls and ceiling, but the transitions make your view do strange things. One thing I found myself wishing for in it was spherical or cylindrical gravity volumes, I wanted to make a space station like the one in 2001: A Space Odyssey.



=o



Quote
Re: 3D combat surface walking
Posted by Crono on Sat Jun 9th at 6:27am 2007


Wouldn't it be a bit easier to find a physics API floating around online?
Or at the least, check out the functions the source engine already provides? (Havok API)

Just to nitpick, the units for these things aren't specifically metric or imperial. For instance, torque can be expressed in Newton per Meter ... Pound per Inch so on and so forth. Of course, generally, the math is easier if expressed in metric.



Blame it on Microsoft, God does.



Quote
Re: 3D combat surface walking
Posted by Stadric on Sat Jun 9th at 7:01am 2007


Well, yeah, but it takes less time to type meter than "generic unit of distance". <img src=" SRC="images/smiles/icon_rolleyes.gif">


Also change the texture of the dock. Docks are rarely tile. -Facepunch
As I Lay Dying



Quote
Re: 3D combat surface walking
Posted by mazemaster on Sat Jun 9th at 9:15am 2007


Some images in this post have been automatically down-sized, click on them to view the full sized versions:

Some images in this post have been automatically down-sized, click on them to view the full sized versions:

Some images in this post have been automatically down-sized, click on them to view the full sized versions:

Some images in this post have been automatically down-sized, click on them to view the full sized versions:Some images in this post have been automatically down-sized, click on them to view the full sized versions:

Some images in this post have been automatically down-sized, click on them to view the full sized versions:Ok, so the basic idea for applying gravity is to figure out which surface is closest to the player (calculate the distance from the player to the surface for each surface), and then use the normal to the closest surface as the gravity direction.

I made some images that show how to calculate the distance from the player to any given triangular surface using simple vector operations. Since the operations are all simple vector manipulations, in theory they could be fast enough for real-time gravity calculations.



image
image

Now I have no clue how to find all the player positions and surface normals and so forth with the SDK, but theres the underlying strategy.

EDIT: Also, I am betting that a lot of these calculations are already done for the purpose of collision detection (how close is the player to a wall?) among other things, so I might not have to redo these calculations each frame. ?




Quote
Re: 3D combat surface walking
Posted by wil5on on Sat Jun 9th at 12:23pm 2007


Doesnt look like it will be immensely computationally expensive, considering that yes, most of these vectors will already be generated (I havent seen the SDK myself personally but theyre definitely used for other calculations in-game) and the mathematical operations are fairly straightforward vector ops.

Of course, it will take a bit of testing and experimenting to see if this "feels" right. One case that springs to mind is the idea of just walking up to a wall: if we are calculating distance from the centre of the player, youll fall into the wall youre walking towards once youre less than half your height away (40ish units in HL/HL2), stand up then fall back onto the floor since standing up pushes your centre away from the wall. Cases like this can make or break it, so just be mindful.

Has anyone considered how to calculate view directions? Does anyone understand quarternions (because I don't, and youll probably need them)?




&quot;If you talk at all during this lesson, you have detention. Do you understand?&quot;
- My yr11 Economics teacher



Quote
Re: 3D combat surface walking
Posted by parakeet on Sun Jun 10th at 6:24pm 2007


The problem here inlies that there is no way to tell the mass of any given wall, that multiple brushes will be seen as multiple masses. If we gave every ground the same force of gravity then it might work. Ugh I'm bad at explaining, but a small tiny blob in space shouldn't pull you off the ground like the real ground does. Maybe we want it to though, clarification would be nice :P.



Quote
Re: 3D combat surface walking
Posted by Crono on Sun Jun 10th at 6:52pm 2007


I imagine Source already has functions in its API for camera control and data retrieval. I'm not sure why people are concerned with the camera ... are you thinking of changing the perspective? In which case, you can implement an "intelligent" camera, personally, I'd use Gears of War as an example.

I think, the easiest way to go about this, that no one has really suggested, would be use some sort of area property, like a hit box, if you want to think of it that way, once entering some mass' area-box you will be affected by it's gravity. Of course, many area-box's can overlap so you just normalize the gravity, and the stronger one wins, generally. If the "planetary" masses are used sparingly, you could just make those physics objects in Source (How many are you really going to have? 10? Ooohh, big deal, that's only 10 physics objects) and you can use this "pull" functionality in addition to the existing physics abilities. As long as the outer world it self doesn't have some gravity constant (currently, in Source, it does, you'd have to overload that), you'll be golden. So golden, that if you launched yourself away from all the masses in the world, you would actually get pulled back towards them if this is done correctly. But this is only if you want to simulate multi-planetary masses with inter-acting gravitational pulls. You could also give them repulsion from one other. After all, you would just negate the force value that is returned from your gravity function.



Blame it on Microsoft, God does.



Quote
Re: 3D combat surface walking
Posted by wil5on on Mon Jun 11th at 12:07am 2007


View directions are what I always stumble on when playing around with things like this. I agree the rest is fairly easy, which is why I brought it up. I dont have the mathematics to do the proper transformations (I'm guessing you do) so I really dont know.

Note that at no point in the game does the players body actually rotate.




&quot;If you talk at all during this lesson, you have detention. Do you understand?&quot;
- My yr11 Economics teacher



Quote
Re: 3D combat surface walking
Posted by mazemaster on Mon Jun 11th at 2:02am 2007


I can do the camera and player body rotation maths with matricies (that is how we did it in physics class where speed, stability, etc wasn't an issue), but I think the industry standard is quaternions like you say. I don't know anything about quaternions, so thats a bit of an issue right now.



Quote
Re: 3D combat surface walking
Posted by Crono on Mon Jun 11th at 5:23am 2007


Even if it is, it'll already be implemented in source, which means you'll just be using an API and not creating the data structure from scratch. You might have some transformation or wrapper functions, but that's not a big deal, in the least.

There's no such thing as an industry standard when it comes to data structures, even if it's the structure most developers use. There are always many options.



Blame it on Microsoft, God does.




Post Reply