Prospero 1 Posted August 26, 2002 Hi all, I was recently playing about with moving static objects around - like the bridge. I would place, say, a police jeep on the bridge, and then setPos the bridge _smoothly_ up and down and see if the jeep stayed on it - i.e. would the bridge "carry" the jeep as it moved? Well, sometimes it did, and sometimes it didn't. When it didn't, the jeep would simply stay where it was and the bridge would move through it. Not good. The problem was understanding why this happens. Well, I think I do now;) And this potentially provides a way of sensing collisions for script-controlled objects too. Effectively, it seems to be to do with speed. Speed, as in the attribute the game assigns to a certain vehicle's simulation model, and which can be accessed by using the Speed command - as in <speed mycar>. To keep the police jeep moving with the bridge, you have to find a way of preventing the jeep's speed ever becoming EXACTLY zero. Providing the speed's magnitude is greater than exactly zero, you're in business, and the jeep stays on the bridge. The speed doesn't need to be large, it just must not be EXACTLY zero. 0.000001 m/s is fine, for example. If you were to watch an AI-controlled jeep slow and stop, its speed is still non-zero for a few seconds AFTER it _appears_ to be stationary. This initially fooled me when I conducted my tests. You can check this yourself by using the Speed command, of course. The question is therefore, how to go about keeping the speed from ever becoming exactly zero? As it is now, the way I'm getting round this is by shooting the jeep with an M16. Sounds stupid, I know, but this method may lead to an elegant solution. Every time you shoot a stationary (zero speed) vehicle, regardless of whether it's manned or unmanned, you give it some speed. A tiny amount of speed, of course, but all we need is for the speed to be non-zero. Grenades work too of course, but that's a little over the top... So one possible idea is to use a simple looped script to camCreate a bullet onto a vehicle (anyone have a sexy way of doing this?). Then, in the same loop, reset the tiny amount of damage done to the vehicle by the bullet (this is a constant) by using the setDamage command. And bingo, we have a jeep which stays "active", and, importantly, the player won't even notice what's going on - providing this can be done silently... Now, what I really want is a way to give a vehicle some speed WITHOUT damaging it. Any ideas? OK, so what about objects to which you've attached your own physics model? In the config.bin file for such an object, one must first specify a simulation-type of "house" because in-game gravity does not affect this simulation-type, but damage still works fine. Going further then, here's what you do: You would make your object as above and continuously camCreate bullets on it during its lifetime - i.e. once every scripted movement cycle. Even though it's of simulation-type "house", this gives it momentary speed and therefore keeps it "active" - and hence it will be damaged when it contacts / is in contact with another game object, thus allowing you to sense when it collides with something. It's not perfect yet, but I thought I'd mention it on the board for the sake of discussion. Prospero Share this post Link to post Share on other sites