Search the Community
Showing results for tags 'characterphysics'.
-
As covered in the topic started by Angelwolf here: http://www.leadwerks.com/werkspace/topic/14318-my-monsters-can-run-through-walls/#entry98176 Characters can walk through objects that have mass no matter what the collision types are set. Attaching an example that shows the issue. The top box has mass and the lower box has no mass. Example that shows the problem: window = Window:Create("monster",0,0,800,600,17) context = Context:Create(window) world = World:Create() camera = Camera:Create() camera:Move(0,8,0) camera:SetRotation(90,0,0) camera:SetDebugPhysicsMode(true) light = DirectionalLight:Create() light:SetRotation(35,35,0) ground = Model:Box(40,1,40) ground:SetPosition(0,-0.5,0) ground:SetColor(0,1,0) shape = Shape:Box(0,0,0, 0,0,0, 40,1,40) ground:SetShape(shape) ground:SetNavigationMode(true) box1 = Model:Box(1,1,5) box1:SetPosition(0,.5,3) shape = Shape:Box(0,0,0, 0,0,0, 1,1,5) box1:SetShape(shape) box1:SetMass(1000) box1:SetCollisionType(Collision.Prop) box2 = Model:Box(1,1,5) box2:SetPosition(0,.5,-3) shape = Shape:Box(0,0,0, 0,0,0, 1,1,5) box2:SetShape(shape) shape:Release() box2:SetCollisionType(Collision.Prop) world:BuildNavMesh() monster = Model:Load("Models/characters/crawler/crawler.mdl") monster:SetPosition(-4,0,0) monster:SetCharacterControllerAngle(180) monster:SetMass(1) monster:SetPhysicsMode(Entity.CharacterPhysics) monster:SetCollisionType(Collision.Character) waypoint = {} waypoint[1] = Pivot:Create() waypoint[1]:SetPosition(4,.5,4) waypoint[2] = Pivot:Create() waypoint[2]:SetPosition(4,.5,-4) waypoint[3] = Pivot:Create() waypoint[3]:SetPosition(-4,.5,1) wpt = 1 while window:KeyHit(Key.Escape)==false do if window:Closed() then break end if window:KeyHit(Key.Space) then wpt = wpt + 1 end if wpt > 3 then wpt = 1 end pos = waypoint[wpt]:GetPosition(true) monster:GoToPoint(pos,2,3) Time:Update() world:Update() world:Render() context:SetBlendMode(Blend.Alpha) context:DrawText("Press SPACE to move to next waypoint",2,2) context:SetBlendMode(Blend.Solid) context:Sync() end