From 62069b31c7d23055f999c70a58ccf7d58acd333f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 20 Dec 2018 18:57:23 -0500 Subject: Added target velocity The acceleration of a Ponderable entity is now only really a magnitude. The direction of acceleration is such that the velocity goes toward the target velocity. If accelerating would cause the velocity to pass the target velocity, it is instead set to the target. This is currently being used to 1) generalize terminal velocity due to gravity, and 2) allow an Orientable entity to accelerate quickly to a walking speed (and to a halt) rather than instantly achieve it. --- src/components/ponderable.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/components/ponderable.h') diff --git a/src/components/ponderable.h b/src/components/ponderable.h index 221d267..cc42048 100644 --- a/src/components/ponderable.h +++ b/src/components/ponderable.h @@ -55,6 +55,11 @@ public: */ vec2d accel = { 0.0, 0.0 }; + /** + * The target velocity of the body. + */ + vec2d targetVel = { 0.0, 0.0 }; + /** * The type of physical body that the entity is meant to assume. The body will * be acted upon differently based on this. See the enumeration above for more -- cgit 1.4.1