adding collision object to impact pathing
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?
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
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.
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-->
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.
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
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.
Any that it will not ignore them?