adding collision object to impact pathing

extolloextollo Ping Blip Join Date: 2010-07-16 Member: 72457Members
i want to be able to dynamically add a object and have it impact GeneratePath (ie Pathing.GetPathPoints).

so i add a physics object similar to a clog

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->losMovementBody = Shared.CreatePhysicsSphereBody(true, radius, 0, coords)
losMovementBody:SetGroup(PhysicsGroup.BigStructuresGroup)
losMovementBody:SetPhysicsType(CollisionObject.Static)
losMovementBody:SetEntity(entity)<!--c2--></div><!--ec2-->

GeneratePath is pathing through the object.

what do?

Comments

  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    Check out ObstacleMixin.
  • extolloextollo Ping Blip Join Date: 2010-07-16 Member: 72457Members
    <!--quoteo(post=1988938:date=Oct 9 2012, 04:33 PM:name=Max)--><div class='quotetop'>QUOTE (Max @ Oct 9 2012, 04:33 PM) <a href="index.php?act=findpost&pid=1988938"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Check out ObstacleMixin.<!--QuoteEnd--></div><!--QuoteEEnd-->

    changed to ..
    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Pathing.AddObstacle(origin+ Vector(0, -100, 0), radius, 1000)<!--c2--></div><!--ec2-->

    Still no work. i'm doing the arcane xlat -Y direction & use a large height that is in AddToMesh

    curious ...

    why does Pathing.GetPathPoints have the Y translation it does on generated path points?

    I had a path that went from 0 to .8 in the Y dir, but the start & intermediate points had a 1.2 Y. the last two points in the path changed to the correct Y at the destination.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    edited October 2012
    Short Answer - So drifters and macs can fly over obstacles.

    All buildings that have obstacle mixin do exactly what you want, they create a dynamic path but, as some AI 'fly' they need to be able to pass over the obstacle where possible.

    I am fairly sure you don't need to amend the pathing settings, just add ObstacleMixin.lua to the load files of the object you are trying to add...

    ie - <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// ======= Copyright (c) 2003-2011, Unknown Worlds Entertainment, Inc. All rights reserved. =======
    //
    // lua\Armory.lua
    //
    //    Created by:   Charlie Cleveland (charlie@unknownworlds.com)
    //
    // ========= For more information, visit us at http://www.unknownworlds.com =====================

    ....
    Script.Load("lua/NanoShieldMixin.lua")
    Script.Load("lua/ObstacleMixin.lua")
    Script.Load("lua/WeldableMixin.lua")
    .......

    .......
    AddMixinNetworkVars(NanoShieldMixin, networkVars)
    AddMixinNetworkVars(ObstacleMixin, networkVars)
    AddMixinNetworkVars(DissolveMixin, networkVars)
    ........

    function Armory:OnCreate()

        ScriptActor.OnCreate(self)
        
        .....
        InitMixin(self, RagdollMixin)
        InitMixin(self, ObstacleMixin)
        InitMixin(self, DissolveMixin)
        .....<!--c2--></div><!--ec2-->
  • extolloextollo Ping Blip Join Date: 2010-07-16 Member: 72457Members
    <!--quoteo(post=1989238:date=Oct 10 2012, 08:53 AM:name=Soul_Rider)--><div class='quotetop'>QUOTE (Soul_Rider @ Oct 10 2012, 08:53 AM) <a href="index.php?act=findpost&pid=1989238"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Short Answer - So drifters and macs can fly over obstacles.

    All buildings that have obstacle mixin do exactly what you want, they create a dynamic path but, as some AI 'fly' they need to be able to pass over the obstacle where possible.<!--QuoteEnd--></div><!--QuoteEEnd-->

    yea, i figured it was for drifters - was just wondering how that was parameterized, so i could change it during generation instead of post processing the path.

    trying the mixin approach next. i was hoping to avoid creating a full entity & just temporarily plop in an obstacle via code as I show in my snippet.
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    If you want to just temp drop an obstacle, why not use something that is already in the game? If you create an instance of the object, then all it's data will be there, and you can then remove it when necessary?

    It's the simplest way to do it as far as I can see, without knowing the full extent of your plans of course. hahaha
  • extolloextollo Ping Blip Join Date: 2010-07-16 Member: 72457Members
    <!--quoteo(post=1989264:date=Oct 10 2012, 10:32 AM:name=Soul_Rider)--><div class='quotetop'>QUOTE (Soul_Rider @ Oct 10 2012, 10:32 AM) <a href="index.php?act=findpost&pid=1989264"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->If you want to just temp drop an obstacle, why not use something that is already in the game? If you create an instance of the object, then all it's data will be there, and you can then remove it when necessary?

    It's the simplest way to do it as far as I can see, without knowing the full extent of your plans of course. hahaha<!--QuoteEnd--></div><!--QuoteEEnd-->

    no. i needed a custom object. i've decided to go in a different direction, but the whole exercise was interesting - knowledge was gained.
  • JimWestJimWest Join Date: 2010-01-03 Member: 69865Members, Reinforced - Silver
    Bring this up, Pathing.GetPoints ignores obstacles (totally?), like armory.
    Any that it will not ignore them?
  • extolloextollo Ping Blip Join Date: 2010-07-16 Member: 72457Members
    . Pathing is fine with inbuilt. I had trouble dynamically creating a custom object that would impact the pathing algorithm. Went in another direction and never went back to see if I could get it to work. May look at this stuff again - i must have accidentally clicked awesome when browsing on my phone. lol that's ok, you're awesome jim.
Sign In or Register to comment.