Jump to content
Sign in to follow this  
SWIFT88

Tide problems....

Recommended Posts

Im currently working with UNN on a mulitple gun script. UNN has succesfully scripted the Gun to work but! when going over bridges, the tide effects the Second gun and jumps about 10/15metres above the model

Any suggestions would be helpful

the second gun has Geometry etc but they are all empty

Share this post


Link to post
Share on other sites

Just a thought, a side effect of placing a "ground" surface or walking surface in a model, near the driver/pilot is that it will ALWAYS report height above ground @ X meters because the model "surface" is always directly below it, no matter if its 1 foot off the real ground or 20,000 foot.

(sorry, not sure if its a Paths LOD or a RoadWay LOD with "paths" or "road" defined in either ..... or both need defining)

I'm assuming the second gun is moved and held in place via a script relative to the vehicles position (or a proxy position).

Heres the thought ........ place one of these surfaces in the model directly below the second gun and it may allow the script to ALWAYS place the gun in at the right height no matter if you pass over a bridge (or jump) or not.

This off course will stuff-up if the vehicle rolls over.

Share this post


Link to post
Share on other sites

Right... its held by a proxy position

here it is shown from my eyes

http://www.project-ukf.com/Swift88/images/WMIK/wmik3.jpg

normal for about 2/3 secs

http://www.project-ukf.com/Swift88/images/WMIK/wmik2.jpg

then a radical jump

leaving the vehicle empty in the front passengers seat

http://www.project-ukf.com/Swift88/images/WMIK/wmik1.jpg

then it resets when the tide goes down again

Share this post


Link to post
Share on other sites

hmmmmmmm ............. I guess this is a little different of a problem.

Would need to see the script to maybe understand

Share this post


Link to post
Share on other sites

hmmmmm .... ok ........ I see the problem you are describing ........... but my suggestion still stands.

Place a roadway or pathway surface in / under the model (ie in the addon p3d) and then when you detect height its reference is always the model ..... no need to worry about bridges, water or any thing.

While I have not experimented myself with this I have seen other complaining about this unwanted effect.

BTW, interesting discussion in that thread, more so for me because I am adding turrets to ships.

(edit) Another BTW, in the test mission the gun doesnt jump for me ..... but I have noticed that water height can differ between computers and servers, even if the mission has the same date & time.

Share this post


Link to post
Share on other sites

narrr ... crazy_o.gif .. thats not going to work me thinks (did some experimenting)..... and come to think of it, the reported side-effect was an airplanes ALTIMETER was not reading correctly while we only have one script way of reading and setting height, (Getpos X) select 2 and setpos.

............ outa ideas now.

Share this post


Link to post
Share on other sites

After the first setpos (use the setpos in a function) check the distance

normally (when there's no jump) between the MG and the object

on which you setpos it, that is a gamelogic or a camera (way better

if the MG is fixed as respect to the hull). Take note of this number.

Then modify the function inserting a distance check after the first

setpos. If the distance is different from the number found

(allow a certain margin of some millimeter), re-setpos

the MG at the current position minus that distance minus the number.

Re-check the distance as the 'distance' command returns an absolute

(positive) number, and in case the distance is still more than

expected (cause probably the direction was the opposite) re-setpos

the turret at the current direction plus the distance found and

minus the number found before.

This should work except the unfortunate case the distance

was opposite and equal to the number found.

So try to model the MG (in O2) so that the number returned as

the distance in the 'normal' situation (the MG appearing in place)

is as close to zero as possible.

Share this post


Link to post
Share on other sites
Quote[/b] ]thats not going to work me thinks (did some experimenting)..... and come to think of it, the reported side-effect was an airplanes ALTIMETER was not reading correctly while we only have one script way of reading and setting height, (Getpos X) select 2 and setpos.

Yeah, I tried roadways on the vehicle, that did not seem to work. A Roadway as a separate object was no better, it just tips the vehicle.

Quote[/b] ]BTW, interesting discussion in that thread, more so for me because I am adding turrets to ships.

Boats work much better, you don’t have any of the problems of bridges or terrain gradients.

Quote[/b] ](edit) Another BTW, in the test mission the gun doesn’t jump for me ..... but I have noticed that water height can differ between computers and servers, even if the mission has the same date & time.

The trick in the example mission, is to get that gun to sit 1.44 meters above the bridge, without moving.

Quote[/b] ]This should work except the unfortunate case the distance was opposite and equal to the number found.

That method works fine for certain addons, but not when you want position an object just within the bridge threshold. The way I see it, it's the order of the internal events in OFP that causes the problem.

Quote[/b] ]1)Get the Z position

2)If it's over a bridge, then adjust the for bridge position. If Z pos-Bridge height <= Bridge threshold then setpos [X,Y,Z Pos- Bridge Height] Esle [X,Y,ZPos + Bridge Height]

3)Apply Setpos command

4)If it's over water then Apply tide height adjustment

5)if Z pos-Bridge height <= Bridge threshold then setpos [X,Y,Z Pos- Bridge Height] Esle [X,Y,ZPos + Bridge Height]

It's step 4 & 5 that causes the problem, as this only ever happens when on a bridge, over water. Bridges over land, don't show the same problems.

It's still the same problem as before. But if you can get your M1A1 mg to sit 1.44 meters above the bridge and not move up and down. Then I'm happy to eat my own words smile_o.gif

Share this post


Link to post
Share on other sites

Try this:

jeep with 2 mg

the addon is under west>car>jeep with machine gun (the first one)

there's still a zone of 3-4 meters at the beginning of the bridge

where the MG is displaced vertically about 80 cm. I didn't have the

time to solve this too.

Share this post


Link to post
Share on other sites

WWIIEC released the first proper towing script years ago and still no solution for the bridge bug?

Like UNN says the OFP engine determines when you setpos something at 0 height,it decides if the bridge or water is 0 height and it usually uses the bridge as 0.

Its easy to get sea level height,bridge height or the proper height you would want.But setpos there is a whole nother can of worms.

I was looking at exact position using the drop command.Only thing I could think to have it properly positioned is to place it as a effect model using the drop command.But how would it be usable,I think drop command would turn it into a effect and the turret may not be usable.

Share this post


Link to post
Share on other sites
Quote[/b] ]Try this:

jeep with 2 mg

the addon is under west>car>jeep with machine gun (the first one)

Thanks,

But all that does, is place the MG on the bridge, next to the jeep?

If you look at the example mission I posted, thats easy enough. It's getting it to stay 1.44 meters above the bridge thats the hard part.

Quote[/b] ]WWIIEC released the first proper towing script years ago and still no solution for the bridge bug?

Like UNN says the OFP engine determines when you setpos something at 0 height,it decides if the bridge or water is 0 height and it usually uses the bridge as 0.

There seems to be a threshold. So as long as the towing pivot point is outside that (roughly 2m), you should be ok. Although I'm not sure how much use this would be.

You could move the pivot point so it lies flush with the ground, but then you will have to much movement at the point where the trailer and vehicle objects meet. Would work ok for flat surfaces like Aircraft carriers, but not on slopes.

Share this post


Link to post
Share on other sites
Quote[/b] ]But all that does, is place the MG on the bridge, next to the jeep?

If you look at the example mission I posted, thats easy enough. It's getting it to stay 1.44 meters above the bridge thats the hard part.

I can't understand your point. Have you tried to make the jeep

pass over a bridge, then maybe fire it or stand still ?

The 1.44 meters value is absolutely arbitrary, I think. If you model

the MG differently in O2, you'll get another value.

With the example I posted above, the goal should be to keep the

number printed on screen as close to zero as possible.

I think this can be achieved only in O2, by carefully modelling the

MG itself.

Also, if you took the patience and unpbo-ed the addon, you'll

see that actually height above sea level is never taken into

consideration. The only value considered is the distance of the

MG from the jeep.

Usually that distance is exploited vertically, that is only on very

steep inclines are the x,y cohords of the setpos command misplaced

from where you want them to be. So you can usually correct only

the z position and get a good result.

One thing you must understand is that if you place two different

objects at exactly the same spot, the result you get by the

'distance' command between the two objects themselves is

NOT zero. Instead, if you make the difference among the x,y,z

cohords, each pair taken by itself and then raised to the square,

sum up all the results and then take the square root, the result

CAN be zero. I hope I've been clear enough you can get the point.

Another benefit of the method used in the pbo file I posted is

that you haven't to place any gamelogic in the model, so you

don't have to worry about them if the jeep cannot move.

Share this post


Link to post
Share on other sites
Quote[/b] ]I can't understand your point. Have you tried to make the jeep

pass over a bridge, then maybe fire it or stand still ?

I do think we have our wires crossed?

I tested camsetrelpos when I first started working of the UKF Landrover. Compared to the Game logics, it does not work very well. The main problem with camsetrelpos is it does not take bank into account. You can see this more on aircraft, I know you used one for a rear gunner. But if the rear gunner sits directly along the aircrafts centre line? Then you would not notice the fact, it does not bank with the aircraft. Pitch works as normal.

Anyway you can see here:

Jeep01.jpg

Jeep02.jpg

Compared to camsetrelpos, Game logics provide a very accurate position of the Jeep, taking both pitch and bank into account.

Quote[/b] ]Also, if you took the patience and unpbo-ed the addon, you'll

see that actually height above sea level is never taken into

consideration. The only value considered is the distance of the

MG from the jeep.

I did, on a couple of occasions. Along with your M1A1 we disscused a few months ago, which uses a similar approach? As well as take these screen shots, and create the original, simplified example mission to demonstrate the problem I was trying to fix smile_o.gif

Quote[/b] ]I hope I've been clear enough you can get the point.

I understand your approach, but I'm not looking for a compromise. Game logics provide the best solution 99% of the time IMHO.

Quote[/b] ]Another benefit of the method used in the pbo file I posted is

that you haven't to place any gamelogic in the model, so you

don't have to worry about them if the jeep cannot move.

I don't mind scripting game logics for a disabled jeep, as this is all be done outside the main loop. I'm just looking for a method that gives the best visual results.

Cheers

Share this post


Link to post
Share on other sites

Ouch .... my heads hurting from all this readin and thinkin tounge2.gif

Just a thought, could the jump or displacment difference be related to the in-model difference between say the Geometric centre of the model and maybe points like "zamerny" ?

Share this post


Link to post
Share on other sites

Ok, thank you for making me notice it. I believed camSetRelPos

worked the same as the drop command. Infact, as you say, the

pitch angle is taken into account using camSetRelPos. I thought

the same was true for bank angle. Anyway, the method should

work the same with gamelogics: instead of taking height above sea

level and things like that, just take the distance and it should work

the same: gamelogics are point objects, aren't they ?

Cameras are: so the same should work for GLs.

Quote[/b] ]Just a thought, could the jump or displacment difference be related to the in-model difference between say the Geometric centre of the model and maybe points like "zamerny" ?

Maybe. I've never looked carefully into that. The only thing I can

suggest is to model the 2nd MG so that the distance between

the point object (either GL or camera) and the MG itself when

this one is positioned in the same [x,y,z] point, as returned by

the point object's position, is as close to zero as possible.

Share this post


Link to post
Share on other sites
I thought the same was true for bank angle.

It is true, otherwise my vapour trail from 8 B52 engines wouldnt work.

Share this post


Link to post
Share on other sites
Quote[/b] ]Just a thought, could the jump or displacment difference be related to the in-model difference between say the Geometric centre of the model and maybe points like "zamerny" ?

Thats what I use autocentre for, you can be exact in positiong the objects pivot point. It's just annoying, that the pivot point of the Landrover MG is just a bit to low.

Quote[/b] ]It is true, otherwise my vapour trail from 8 B52 engines wouldnt work.

The Drop command or SetCamRelPos?

Quote[/b] ]I thought the same was true for bank angle.

I think I mentioned it, when we first started messing around with OWP Mi26. But your idea of detecting when the object is permanently sepearated from the vehicle, does help solve other problems. Just not the one with the Setpos command.

Quote[/b] ]Anyway, the method should

work the same with gamelogics: instead of taking height above sea

level and things like that, just take the distance and it should work

the same: gamelogics are point objects, aren't they ?

Cameras are: so the same should work for GLs.

Yeah, but whatever method you use to get the correct position. You still have to use setpos to get it there, thats when the problems seem to start.

Myself, I have started to think about ways of hiding the effect now, rather than trying to beat it. Although, I will wait and see if anything else comes from this thread. I don't want to have to change track half way though.

Share this post


Link to post
Share on other sites
Quote[/b] ]Yeah, but whatever method you use to get the correct position. You still have to use setpos to get it there, thats when the problems seem to start.

Call me stupid, but what's the big problem ? You place the gun

relatively to its position: there are three nested if sentences on

placeit.sqf just for this reason (actually, I used even four with

better results, that is the glitch at bridge beginning practically

disappears): the function setpos the gun on the camera position;

then check the distance; if it's not the right one, it reposition

the gun subtracting the distance itself; if it's not the right one

yet, it does another re-positioning. Before or after it usually gets

the position right. Since it's a function that does this all, the user

cannot realize it. In the script I posted, a wrong positioning can

happen when the road is on a very gentle dive, but this can be solved.

I think the problem lies only in adapting the concept to your addon,

and it should not be too difficult. Or either make use of both ways,

but is seems to me unnecessary complicated.

Share this post


Link to post
Share on other sites
Quote[/b] ]The Drop command or SetCamRelPos?

Oops ... yeh ... soz ... thats the Drop command

Quote[/b] ] there are three nested if sentences on

placeit.sqf

But whats the effect on CPU load like.

Dropping a couple of Landrovers onto a map could be the end of your frame rate.

Share this post


Link to post
Share on other sites
Quote[/b] ]Call me stupid, but what's the big problem ?

It's hard to explain, the best I can so is. Tides appear to affect objects after you have setpos'ed them, not before or during the setpos. Again the example mission is the simplest example, you know the bridge is 20 meters, you know you want the gun at 1.44 above the bridge, you also know the tide height. So it should be easy, just setpos (in a loop) the gun at 21.44 meters, taking the tides height into account. And it should appear 1.44 meters above the bridge, but it never stays there. But if you change the offset to either 1 meters above the bridge, or two meters above the bridge then it's possible to make to gun appear to be static. So I assume it's a combination of the 1.44 meters and tides?

Quote[/b] ]Oops ... yeh ... soz ... thats the Drop command

I see. You can use the drop command, to drop a basic particle. Then grab it's XYZ position.

Share this post


Link to post
Share on other sites

Have you tried, UNN, with taking the distance from the GL and the

MG (as I did with the example I posted above): since I think we

can't understand properly (english not being my mother tongue)

here's a video:

bridge.avi

Is this what you're looking for ? If not, what's the difference ?

Can you make a video with the actual addon ?

Quote[/b] ]So I assume it's a combination of the 1.44 meters and tides?

with the distance method this should be easy to set: also, have

you tried building the MG a little differently, for example putting

some isolated point in the geometry (even I think it's better this

kind of thing not to have a geometry) to offset the 1.44 value ?

Share this post


Link to post
Share on other sites
Quote[/b] ]Is this what you're looking for ? If not, what's the difference ?

I can't load the video, something to do with codec's.

Quote[/b] ]Can you make a video with the actual addon ?

I'm not sure how much help a video will be. I can setup your M1A1 to position the mg 1.44 meters above ground? If you change it to 1.44, then you see the same problem.

But I still think the example mission is the easiest to work with. You setpos the MG at 20+1.44-(Tide Height), when the MG is displaced above the bridge it moves to 20+20+1.44-(Tide Height). So in theory it should be easy enough to adjust, when it's displaced. But in practice, it isn't.

I've spent many hours getting the same results, but I may well have missed something. I just cant face going back, and repeating same experiments, all over again confused_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×