Jump to content
bobby budnick

Allow a large vehicle to knock over/destroy all objects in it's way?

Recommended Posts

Trying to find a solution to this I have resorted to using a script to hideObject all the obstacles in my path.  But I am having to do it out to a large distance around me because it takes time for the object collision to be removed.  Is there a better way to do this?

Share this post


Link to post
Share on other sites

if you put the hideObject code in onEachFrame it should happen instantly.

Share this post


Link to post
Share on other sites

You could try using an EpeContactStart eventhandler but I'm not sure if that also fires when colliding with static objects. (never tested it)

 

If it does, then you can run a loop to store the current velocity of your vehicle (maybe every half second) and when the EH triggers you just remove the obstacle and restore the saved velocity to your vehicle so it doesn't get slowed down.

Share this post


Link to post
Share on other sites

Thanks for the reply.  Unfortunately onEachFrame did not help.  Certain deep jungle trees on Tanoa require around a 75 meter deletion range.  If I reduce the range to 50 I will start bumping into invisible trees.  Is there any other workaround?

 

edit:

 

Thanks for the second reply.  I was hoping to avoid the collisions entirely.

Share this post


Link to post
Share on other sites

If it works well you might not even notice them. Anyway what exactly are you using this for? There are sometimes alternative solutions that are not obvious and can only be found by knowing the details.

 

 

Maybe you can improve things by changing the way you detect those objects. Here's an example:

clearWayVehicles = [yourvehiclename];
clearWayEH = addMissionEventHandler ["EachFrame",{
    {
        _bb = boundingBoxReal _x;
        _bb1 = _bb select 0;
        _bb2 = _bb select 1;
        _z = ((_bb1 select 2) + (_bb2 select 2))/2;
        _y = (_bb1 select 1) + 1;
        _p1 = [(_bb1 select 0) - 1, _y, _z];
        _p2 = [(_bb2 select 0) + 1, _y, _z];
        
        _pos1 = _x modelToWorldVisual _p1;
        _pos2 = _x modelToWorldVisual _p2;
        _int = lineIntersectsObjs[_pos1, _pos2, objnull, _x, false, 48];
        hideObject _int;
    } forEach clearWayVehicles;
}];

This should catch and hide any objects that cross a horizontal line 1m in front of the vehicle.

You can also use multiple intersectlines if that one doesn't suffice.

Share this post


Link to post
Share on other sites

That's probably not going to work.  It looks fancy though.

 

Some of the trees on Tanoa are being visually removed long before their collision is removed.  Thus I have to scan a large distance around me to ensure their collision is being removed before I reach them.  This makes me a walking target.  I have partially compensated for this by using IR optics more, bringing along AI, and upgrading the vehicle config. I can't just scan in front either.  If I decide to change course then there will not be enough time to remove the collision model.

 

I am piloting a Mecha-type vehicle.  In Mecha land, trees are not the obstacles they are in this game.  It doesn't help that the Mech tends to flip and bounce around and take damage when it collides with something, which is another problem entirely.

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

×