|
Re: Pointer troubles: Need Help
[Re: Jaeger]
#267958
05/27/09 01:22
05/27/09 01:22
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Very odd. I dont understand how it even compiles without generating a "wrong number/type of parameters" error.
Once Im alone-ish, I'll have a look at the whole "tank_controls" action and tidy/fine-tune it a bit.
Is is seriously different to what you posted about 8 post back? The post where you posted a whole main.c file for testing. (your post started with "No, it's not the level, and not the model.")
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Pointer troubles: Need Help
[Re: Jaeger]
#267959
05/27/09 01:37
05/27/09 01:37
|
Joined: May 2009
Posts: 258 Chicago
Jaeger
OP
Member
|
OP
Member
Joined: May 2009
Posts: 258
Chicago
|
Ok, well I tried to transfer the code from the block level to the tank project, and freaked out when it didn't work. Then I realized that it was due to the high gravity I was using. So now I have to work out mass, gravity, and force to get everything correct. What do you usually use for gravity? I want to try to keep the mass of every object true to it's real life mass using metric (kg, g, mg, etc).
This kind of exposes an amateurish mistake I've made: not planning ahead. So now I need to take measurements of my terrain, get everything scaled correctly down to the milimeter, and work out a usable in-game scale. I was wondering the other day why it took far more velocity than it should have to get bullets firing at a reasonable trajectory, in reference to what I've seen such rounds do in other games and real life. Gravity was WAY too high, and though my masses were correct, it took more initial force to make bullets fly properly.
The only thing I don't get now is what value gravity should actually be. I need it to properly simulate earth's gravity. Then I can correct any problems with mass, and make my velocities for bullets, and even force/torque on the tank correct.
EDIT: No, that post was a main.c for the test I was doing with plain old blocks. If you'd like to see the whole code, or just the whole tanks action, I can post or give it to you.
Last edited by Jaeger; 05/27/09 01:40.
|
|
|
Re: Pointer troubles: Need Help
[Re: Jaeger]
#267961
05/27/09 01:56
05/27/09 01:56
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
ph_setgravity values ALSO require your ssize-cales to be known to be accurately set.
Chck the comments of the ph_setgravity manual entry and you see the formula to use.
As a crude start, assuming your scale is "about" 1 inch = 1 quant = 2.5cm, then your ph_setgravity will be about 1200 ph_setgravity(vector(0,0,-1200));
PS Id rather see the thing, so post or PM it to me. Please...
PPS Also, open your tank in MED, go EDIT-ScaleModelGlobal and write down its current dimensions. Send me them. (they are in quants)
Last edited by EvilSOB; 05/27/09 01:59.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Pointer troubles: Need Help
[Re: Jaeger]
#267963
05/27/09 02:15
05/27/09 02:15
|
Joined: May 2009
Posts: 258 Chicago
Jaeger
OP
Member
|
OP
Member
Joined: May 2009
Posts: 258
Chicago
|
Ok, model dimensions are a mere:
12.191 x 5.505 x 4.878
Terrain size is: horizontal : 6975 vertical : 6510
What I'd like to do is have the terrain equal to about 10x10km. At least 5x5km. (It needs to be big, because I plan on turning this into a seek and destroy demo, where you can play as either the Panzer IV or British Crusader Mk.II out in the desert. Tank guns usually have a range of 2km!This Panzer can hit at almost 2.5km under ideal conditions. :D) So it must be quite large. Then have the tank be properly scaled in the world to reflect that.
Re-read that part of the manual for gravity and scaling. Makes sense to me now. Let me grab a pen and paper and work out some calculations....
EDIT: Well, in the following equation... :
G = (-9.81m/s2)
...what exactly is "m" supposed to be? They say on a normal quant scale, where 1q = 1inch, they derive:
Gravity => (-9.81 * 100 / 2.54cm) = -386
Where is the 100 coming from?
Last edited by Jaeger; 05/27/09 03:10.
|
|
|
Re: Pointer troubles: Need Help
[Re: Jaeger]
#267969
05/27/09 03:22
05/27/09 03:22
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I havent looked at code yet, I'll do that later. OK, a bit of testing shows that MED doesnt like terrains larger than 65535 x 65535 quants.
EXAMPLE 1 :: Initial Scaleing Run. So, if we scale to a VERY rounded version of that(65000), and go 1quant = 1 meter, then we get a MED-limited terrain maximum of 65KM x 65KM. Plenty big enough. (so it seems, read on). Now we scale our tank by that and we end up with a model that is approx 12x5x5 quants. That doesnt leave much space for collision calculations. NEED MORE!!!
Backtrack... So if leave our med terrain as 1quant = 1meter, but IN_GAME scale it up by a factor of 10, (note: you cant in-game scale terrains much more than 10 or they start lookin too chunky) that will then make it 10 quants = 1 meter, read as 1quant = 10centimeters. Now we scale our tank to that and we get 120x50x50 quants, better. And hopefully enough.
EXAMPLE 2 :: But for learning purposes, assume its not enough. Still too small!!! Start Again.... Now lets try again, this time callin our original terrain scaling 1quant = 2meters (thereby MED limited to 32.5km x 32.5km), and in-game-scale it up by 10, then our tank would be 240x100x100 quants. Definately good enough, but more careful thought is required matching scales of everything. But you see the concept?
Lets ASSUME we've settled on the scales of Example 1. That is, our overall scale is 1quant = 10cm. 1> Open the tank in MED, go EDIT-ScaleModelGlobal. Put in one of the new sizes, being 240 or 100. Then hit the tab-key and the other numbers will self-ajust. If you put the right number in the right box(all number match expected), hit OK and save. 2> The terrain doesnt need changing in this case, but theoretically,Open the terrain in MED, go EDIT-ChangeTerrainSize. Put the width (divided by 10 remember) into the 'Terrain Size Horizontal' box, hit tab-key and fill the 'Terrain Size Vertical' box with the height (divided by 10 remember) and hit tab. The face sizes will self adjust.
God, I think this will do for one post, only just noticed how big its got.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Pointer troubles: Need Help
[Re: EvilSOB]
#267971
05/27/09 03:43
05/27/09 03:43
|
Joined: May 2009
Posts: 258 Chicago
Jaeger
OP
Member
|
OP
Member
Joined: May 2009
Posts: 258
Chicago
|
Yes, I get it. I was going to ask what you thought of 1q/1m. I assume I can keep the terrain in the MED size limits, then I can rescale it in WED to anything up to 100kx100k quants (WED's size limit). Then I can scale all models in MED to match up to my scale.
What I don't get now is how to figure out gravity. From above post...
G = (-9.81m/s2)
...what exactly is "m" supposed to be? They say on a normal quant scale, where 1q = 1inch, they derive:
Gravity => (-9.81 * 100 / 2.54cm) = -386
Where is the 100 coming from? Is that "magnitude", as in a percentage 0-100? 100 being 100% the magnitude of earth's gravity?
Last edited by Jaeger; 05/27/09 03:44.
|
|
|
Re: Pointer troubles: Need Help
[Re: Jaeger]
#267975
05/27/09 04:30
05/27/09 04:30
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
The m is for meters. The s is for seconds. Its a universal physics formula. The 100 come is because the (1inch)2.54 is in centimeters, so multiply by 100 to get back to meters.
So if the universal formula for earth-like gravity is G = (-9.81m/s2) So if we are using 1quant = 2.54 cm, then 1meter = (100cm/2.54quants) = (100/2.54) = 39.4 So to convert our Universal formula(which uses meters) to 3DGS our formula(which uses quants) G = ( -9.81m / s2) == G = ( -9.81m ) / s2 == G = ( -9.81m ) / s2 * (quants/meter) == G = ( -9.81m * (100cm/2.54quants) ) / s2 == G = ( -9.81m * (100 / 2.54) ) / s2 == G = ( -9.81m * 100 / 2.54 ) / s2 == -386 /s2
So in our case, assuming our scale is 1quant = 10cm, our formula boils down to G = ( -9.81m * (100 / 10) ) / s2 == G = ( -9.81m * 10 ) / s2 == -98.1 /s2 So we should use ph_setgravity(vector(0,0,-98.1)); in order to match our scaling.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Pointer troubles: Need Help
[Re: EvilSOB]
#267980
05/27/09 04:56
05/27/09 04:56
|
Joined: May 2009
Posts: 258 Chicago
Jaeger
OP
Member
|
OP
Member
Joined: May 2009
Posts: 258
Chicago
|
Ah, now I get it. Hmm.. Maybe the manual could be a little more clear about the formula. Now I recognize it's the basic Newtonian Gravitational Formula.
Now I see how to get my bullets traveling at the correct speed too. Velocity is independent of mass... It's just velocity, lol. It doesn't matter if you weigh 100lbs or 10,000lbs, 65mphr is 65mphr. Mass just dictates your resistance to changes in velocity. I also assume for something as streamlined as a bullet, very, very low damping should be used, to simulate its conical, aerodynamic shape. I also assume the velocity vector is in quants per sec? So if our scale is 10cm = quant, and I need my bullet to travel 800m/s:
800 m = 800 * 100 = 800,000cm <-- Lol, I'm so retarded (edit) 800,000 / 10 = 80,000q/s???
That seems extraordinarily high...
EDIT: Well, maybe it won't when everything is rescaled, which is going to be quite larger...
Last edited by Jaeger; 05/27/09 05:54.
|
|
|
|