From 41ee2b947c75657c5fdd116837836c1243d29f86 Mon Sep 17 00:00:00 2001 From: oakes Date: Fri, 18 Apr 2014 20:51:24 -0400 Subject: [PATCH] Add capsules and cones --- src/play_clj/g3d_physics.clj | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/play_clj/g3d_physics.clj b/src/play_clj/g3d_physics.clj index cae91fb..213a589 100644 --- a/src/play_clj/g3d_physics.clj +++ b/src/play_clj/g3d_physics.clj @@ -5,8 +5,8 @@ (:import [com.badlogic.gdx.math Matrix4] [com.badlogic.gdx.physics.bullet Bullet] [com.badlogic.gdx.physics.bullet.collision btBoxShape - btCollisionDispatcher btCylinderShape btCollisionObject - btDefaultCollisionConfiguration btDbvtBroadphase + btCollisionDispatcher btCylinderShape btCapsuleShape btConeShape + btCollisionObject btDefaultCollisionConfiguration btDbvtBroadphase btSphereShape] [com.badlogic.gdx.physics.bullet.dynamics btDiscreteDynamicsWorld btDynamicsWorld btRigidBody btRigidBody$btRigidBodyConstructionInfo @@ -177,6 +177,34 @@ [object k & options] `(u/call! ^btBoxShape ~object ~k ~@options)) +(defn capsule-shape* + [radius height] + (btCapsuleShape. radius height)) + +(defmacro capsule-shape + "Returns a btCapsuleShape." + [radius height & options] + `(u/calls! ^btCapsuleShape (capsule-shape* ~radius ~height) ~@options)) + +(defmacro capsule-shape! + "Calls a single method on a `capsule-shape`." + [object k & options] + `(u/call! ^btCapsuleShape ~object ~k ~@options)) + +(defn cone-shape* + [radius height] + (btConeShape. radius height)) + +(defmacro cone-shape + "Returns a btConeShape." + [radius height & options] + `(u/calls! ^btConeShape (cone-shape* ~radius ~height) ~@options)) + +(defmacro cone-shape! + "Calls a single method on a `cone-shape`." + [object k & options] + `(u/call! ^btConeShape ~object ~k ~@options)) + (defn cylinder-shape* [half-extents] (btCylinderShape. half-extents))