diff --git a/Nu/Nu.Template.Export/Nu.Game.zip.REMOVED.git-id b/Nu/Nu.Template.Export/Nu.Game.zip.REMOVED.git-id index ded9a0852e..eb14bc8407 100644 --- a/Nu/Nu.Template.Export/Nu.Game.zip.REMOVED.git-id +++ b/Nu/Nu.Template.Export/Nu.Game.zip.REMOVED.git-id @@ -1 +1 @@ -a614717e0e76986fd9cbcae306630ae2f8aa7cfa \ No newline at end of file +762c83694dc72e952380c4fbeac6ad0ead04a743 \ No newline at end of file diff --git a/Nu/Nu.Template/MyGameplay.fs b/Nu/Nu.Template/MyGameplay.fs index a5d3d3591d..102c6798ff 100644 --- a/Nu/Nu.Template/MyGameplay.fs +++ b/Nu/Nu.Template/MyGameplay.fs @@ -35,19 +35,19 @@ type MyGameplayDispatcher () = | Jump -> let physicsId = Simulants.Player.GetPhysicsId world if World.isBodyOnGround physicsId world then - let world = World.applyBodyForce (v2 0.0f 2000000.0f) physicsId world + let world = World.applyBodyForce (v2 0.0f 200000.0f) physicsId world World.playSound 1.0f (asset "Gameplay" "Jump") world else world | MoveLeft -> let physicsId = Simulants.Player.GetPhysicsId world if World.isBodyOnGround physicsId world - then World.applyBodyForce (v2 -30000.0f 0.0f) physicsId world - else World.applyBodyForce (v2 -7500.0f 0.0f) physicsId world + then World.applyBodyForce (v2 -3000.0f 0.0f) physicsId world + else World.applyBodyForce (v2 -750.0f 0.0f) physicsId world | MoveRight -> let physicsId = Simulants.Player.GetPhysicsId world if World.isBodyOnGround physicsId world - then World.applyBodyForce (v2 30000.0f 0.0f) physicsId world - else World.applyBodyForce (v2 7500.0f 0.0f) physicsId world + then World.applyBodyForce (v2 3000.0f 0.0f) physicsId world + else World.applyBodyForce (v2 750.0f 0.0f) physicsId world | EyeTrack -> if World.getTickRate world <> 0L then Simulants.Game.SetEyeCenter (Simulants.Player.GetCenter world) world diff --git a/Nu/Nu/Constants.fs b/Nu/Nu/Constants.fs index 0ad9d7346b..5171be16c4 100644 --- a/Nu/Nu/Constants.fs +++ b/Nu/Nu/Constants.fs @@ -76,7 +76,7 @@ module Constants = let (*Literal*) PhysicsStepRate = 1.0f / single Engine.DesiredFps let [] PhysicsToPixelRatio = 64.0f let (*Literal*) PixelToPhysicsRatio = 1.0f / PhysicsToPixelRatio - let [] NormalDensity = 10.0f // NOTE: this seems to be a stable density for Farseer + let [] NormalDensity = 1.0f let (*Literal*) Gravity = Vector2 (0.0f, -9.80665f) * PhysicsToPixelRatio let [] CollisionProperty = "C" let (*Literal*) MessageListConfig = Functional diff --git a/Nu/Nu/WorldEntity.fs b/Nu/Nu/WorldEntity.fs index 14a203f77f..06a47c597a 100644 --- a/Nu/Nu/WorldEntity.fs +++ b/Nu/Nu/WorldEntity.fs @@ -175,12 +175,8 @@ module WorldEntityModule = /// Propagate entity physics properties into the physics system. member this.PropagatePhysics world = World.withEventContext (fun world -> - if WorldModule.isSimulantSelected this world then - let facets = this.GetFacets world - Array.fold (fun world (facet : Facet) -> - let world = facet.UnregisterPhysics (this, world) - facet.RegisterPhysics (this, world)) - world facets + if WorldModule.isSimulantSelected this world + then World.propagateEntityPhysics this world else world) this world diff --git a/Nu/Nu/WorldModuleEntity.fs b/Nu/Nu/WorldModuleEntity.fs index 48a7ca5448..876c9235a1 100644 --- a/Nu/Nu/WorldModuleEntity.fs +++ b/Nu/Nu/WorldModuleEntity.fs @@ -684,6 +684,11 @@ module WorldModuleEntity = Array.fold (fun world (facet : Facet) -> facet.UnregisterPhysics (entity, world)) world facets) entity world + static member internal propagateEntityPhysics entity world = + let world = World.unregisterEntityPhysics entity world + let world = World.registerEntityPhysics entity world + world + static member internal addEntity mayReplace entityState entity world = // add entity only if it is new or is explicitly able to be replaced @@ -823,6 +828,8 @@ module WorldModuleEntity = Map.fold (fun world propertyName property -> World.setEntityProperty propertyName false false property entity world) world descriptor.SimulantProperties + let world = + World.propagateEntityPhysics entity world (entity, world) /// Create an entity and add it to the world. diff --git a/Projects/BlazeVector/BlazeDispatchers.fs b/Projects/BlazeVector/BlazeDispatchers.fs index 0f4fb78f75..2ad390fcd7 100644 --- a/Projects/BlazeVector/BlazeDispatchers.fs +++ b/Projects/BlazeVector/BlazeDispatchers.fs @@ -41,7 +41,7 @@ module BulletModule = static member Properties = [define Entity.Size (Vector2 (20.0f, 20.0f)) define Entity.Omnipresent true - define Entity.Density 0.25f + define Entity.Density 0.1f define Entity.Restitution 0.5f define Entity.LinearDamping 0.0f define Entity.GravityScale 0.0f @@ -72,7 +72,7 @@ module EnemyModule = inherit EntityDispatcher () static let move (enemy : Entity) world = - let force = Vector2 (-2000.0f, -20000.0f) + let force = Vector2 (-250.0f, -2500.0f) World.applyBodyForce force (enemy.GetPhysicsId world) world static let die (enemy : Entity) world = @@ -135,9 +135,9 @@ module PlayerModule = type PlayerDispatcher () = inherit EntityDispatcher () - static let [] WalkForce = 8000.0f - static let [] FallForce = -30000.0f - static let [] ClimbForce = 12000.0f + static let [] WalkForce = 1000.0f + static let [] FallForce = -4000.0f + static let [] ClimbForce = 1500.0f static let createBullet (player : Entity) (playerTransform : Transform) world = let (bullet, world) = World.createEntity None DefaultOverlay player.Parent world @@ -148,7 +148,7 @@ module PlayerModule = (bullet, world) static let propelBullet (bullet : Entity) world = - let world = World.applyBodyLinearImpulse (Vector2 (35.0f, 0.0f)) (bullet.GetPhysicsId world) world + let world = World.applyBodyLinearImpulse (Vector2 (15.0f, 0.0f)) (bullet.GetPhysicsId world) world World.playSound 1.0f Assets.ShotSound world static let shootBullet (player : Entity) world = @@ -191,7 +191,7 @@ module PlayerModule = if tickTime >= player.GetLastTimeJumpNp world + 12L && tickTime <= player.GetLastTimeOnGroundNp world + 10L then let world = player.SetLastTimeJumpNp tickTime world - let world = World.applyBodyLinearImpulse (Vector2 (0.0f, 18000.0f)) (player.GetPhysicsId world) world + let world = World.applyBodyLinearImpulse (Vector2 (0.0f, 2000.0f)) (player.GetPhysicsId world) world let world = World.playSound 1.0f Assets.JumpSound world world else world diff --git a/Projects/Elmario/Elmario.fs b/Projects/Elmario/Elmario.fs index 6f512252e9..e14720731a 100644 --- a/Projects/Elmario/Elmario.fs +++ b/Projects/Elmario/Elmario.fs @@ -38,17 +38,17 @@ type ElmarioDispatcher () = | MoveLeft -> let physicsId = Simulants.Elmario.GetPhysicsId world if World.isBodyOnGround physicsId world - then World.applyBodyForce (v2 -30000.0f 0.0f) physicsId world - else World.applyBodyForce (v2 -7500.0f 0.0f) physicsId world + then World.applyBodyForce (v2 -3000.0f 0.0f) physicsId world + else World.applyBodyForce (v2 -750.0f 0.0f) physicsId world | MoveRight -> let physicsId = Simulants.Elmario.GetPhysicsId world if World.isBodyOnGround physicsId world - then World.applyBodyForce (v2 30000.0f 0.0f) physicsId world - else World.applyBodyForce (v2 7500.0f 0.0f) physicsId world + then World.applyBodyForce (v2 3000.0f 0.0f) physicsId world + else World.applyBodyForce (v2 750.0f 0.0f) physicsId world | Jump -> let physicsId = Simulants.Elmario.GetPhysicsId world if World.isBodyOnGround physicsId world then - let world = World.applyBodyForce (v2 0.0f 2000000.0f) physicsId world + let world = World.applyBodyForce (v2 0.0f 200000.0f) physicsId world World.playSound 0.5f (asset "Gameplay" "Jump") world else world | Nop -> world