Example #1
0
        private void updateActorPhysics()
        {
            foreach (Actor actor in actorManager.getActors())
            {
                float coefficientOfFriction = .01f;

                //if the actor is on solid groung
                if (islandManager.getClosestIslandToLocation(actor.getLocation()).getPathingProfile().isActorStanding(actor))
                {
                    coefficientOfFriction = .3f;
                }

                if (Ocean.pointIsUnderWater(actor.getFootLocation()))
                {
                    coefficientOfFriction += .1f;
                }

                actor.updatePhysics(coefficientOfFriction);
            }
        }
Example #2
0
        private void handleAddVelocityAction(Vector3 velocityAddition, Actor actor, bool isFootPropelled)
        {
            Island closestIsland = islandManager.getClosestIslandToLocation(actor.getLocation());

            if (closestIsland == null)// if no islands are loaded
            {
                actor.setVelocity(new Vector3());
            }
            else
            {
                List <BlockLoc>      intersectedByActor = actor.getBlocksIntersectedByAABB();
                IslandPathingProfile profile            = closestIsland.getPathingProfile();
                if (!profile.isActorStanding(actor) && actor.canBeKnockedBack() && isFootPropelled && !Ocean.pointIsUnderWater(actor.getFootLocation()))
                {
                    actor.addToVelocity(velocityAddition * .02f);//character propells slowly in midair
                    return;
                }
                foreach (BlockLoc test in intersectedByActor)
                {
                    if (profile.isProfileSolidAtWithWithinCheck(test))
                    {
                        actor.setFootLocation(actor.getFootLocation() + new Vector3(0, .3f, 0));
                        return;
                    }
                }
                actor.addToVelocity(velocityAddition);
            }
        }