Scripts / Help with collision [Script help]

Author
Message
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Apr 2017 17:10
Hi guys,
just wondering if anyone has manged to stop waterbirds and fish from going into the scenery, I have managed to get the birds to stay and land on water but they fly through the landscape, the fish now stay underwater but also swim into the landscape.

Do we set waypoints? how do I set the boundries? as with everything I am still learning LUA I have managed to edit them to set the bird on water and fish in water but don't how to tell them not to go through the landscape. any help appreciated

Welcome to the real world!
Windows 10 Pro x64 - Core i7-2600K @3.40GHz - 32.0GB RAM - GeForce GTX 950 2GB - 4x500GB SSD Striped
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 7th Apr 2017 17:36
Sorry for posting in wrong forum
Welcome to the real world!
Windows 10 Pro x64 - Core i7-2600K @3.40GHz - 32.0GB RAM - GeForce GTX 950 2GB - 4x500GB SSD Striped
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Apr 2017 18:09 Edited at: 7th Apr 2017 18:11
use GetTerrainHeight(x,z)
or in the case of fish just make sure they don't go up in height at all otherwise turn them around would be easier.

but as long as something has collision enabled it will not be able to pass through the terrain... but if we're talking about going through buildings and such then you're going to need to treat them as characters and use the AI system.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Apr 2017 19:05
Well I can tell you what I do with the helicopters if that helps.

1) I work out a point some distance ahead of where the heli is currently going and check whether any other heil or the terrain at that point is inside a sphere of a certain radius of that point. If it is I adjust the direction of the helicopter appropriately to try and avoid that point.
2) Next do a similar thing with a closer point but the adjustment made is greater.
3) Do a similar thing but with the point that the heli will be in next frame, this represents an actual collision that is going to happen, in this case the adjustment is severe enough to hopefully avoid the collision but makes the movement more jerky.

One problem I have with this method is that if helicopters approach each other on almost parallel trajectories they don'y 'see' each other until the last moment and then they start a weird jerky dance in mid air!

The Bullet physics engine could be used for this sort of thing and I was hoping that as part of the supposed AI improvements Lee would provide a mechanism for us to use the full power of it but that hasn't happened.

If you watch the AI characters they don't avoid each other either, or other moving objects for that matter, they just react to the collision when it happens which makes them look really stupid!
Been there, done that, got all the T-Shirts!
PM

Login to post a reply

Server time is: 2024-03-29 13:49:36
Your offset time is: 2024-03-29 13:49:36