• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 3.0.8
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package com.badlogic.gdx.physics.bullet.collision;
10 
11 import com.badlogic.gdx.physics.bullet.BulletBase;
12 import com.badlogic.gdx.physics.bullet.linearmath.*;
13 import com.badlogic.gdx.math.Vector3;
14 import com.badlogic.gdx.math.Quaternion;
15 import com.badlogic.gdx.math.Matrix3;
16 import com.badlogic.gdx.math.Matrix4;
17 
18 public class btCollisionObject extends BulletBase implements
19 	com.badlogic.gdx.utils.Disposable
20  {
21 	private long swigCPtr;
22 
btCollisionObject(final String className, long cPtr, boolean cMemoryOwn)23 	protected btCollisionObject(final String className, long cPtr, boolean cMemoryOwn) {
24 		super(className, cPtr, cMemoryOwn);
25 		swigCPtr = cPtr;
26 	}
27 
28 	/** Construct a new btCollisionObject, normally you should not need this constructor it's intended for low-level usage. */
btCollisionObject(long cPtr, boolean cMemoryOwn)29 	public btCollisionObject(long cPtr, boolean cMemoryOwn) {
30 		this("btCollisionObject", cPtr, cMemoryOwn);
31 		construct();
32 	}
33 
34 	@Override
reset(long cPtr, boolean cMemoryOwn)35 	protected void reset(long cPtr, boolean cMemoryOwn) {
36 		if (!destroyed)
37 			destroy();
38 		super.reset(swigCPtr = cPtr, cMemoryOwn);
39 	}
40 
getCPtr(btCollisionObject obj)41 	public static long getCPtr(btCollisionObject obj) {
42 		return (obj == null) ? 0 : obj.swigCPtr;
43 	}
44 
45 	@Override
finalize()46 	protected void finalize() throws Throwable {
47 		if (!destroyed)
48 			destroy();
49 		super.finalize();
50 	}
51 
delete()52   @Override protected synchronized void delete() {
53 		if (swigCPtr != 0) {
54 			if (swigCMemOwn) {
55 				swigCMemOwn = false;
56 				CollisionJNI.delete_btCollisionObject(swigCPtr);
57 			}
58 			swigCPtr = 0;
59 		}
60 		super.delete();
61 	}
62 
63 	/** Provides direct access to the instances this wrapper managed. */
64 	public final static com.badlogic.gdx.utils.LongMap<btCollisionObject> instances = new com.badlogic.gdx.utils.LongMap<btCollisionObject>();
65 
66 	/** @return The existing instance for the specified pointer, or null if the instance doesn't exist */
getInstance(final long swigCPtr)67 	public static btCollisionObject getInstance(final long swigCPtr) {
68 		return swigCPtr == 0 ? null : instances.get(swigCPtr);
69 	}
70 
71 	/** @return The existing instance for the specified pointer, or a newly created instance if the instance didn't exist */
getInstance(final long swigCPtr, boolean owner)72 	public static btCollisionObject getInstance(final long swigCPtr, boolean owner) {
73 		if (swigCPtr == 0)
74 			return null;
75 		btCollisionObject result = instances.get(swigCPtr);
76 		if (result == null)
77 			result = new btCollisionObject(swigCPtr, owner);
78 		return result;
79 	}
80 
81 	/** Add the instance to the managed instances.
82 	 * You should avoid using this method. This method is intended for internal purposes only. */
addInstance(final btCollisionObject obj)83 	public static void addInstance(final btCollisionObject obj) {
84 		instances.put(getCPtr(obj), obj);
85 	}
86 
87 	/** Remove the instance to the managed instances.
88 	 * Be careful using this method. This method is intended for internal purposes only. */
removeInstance(final btCollisionObject obj)89 	public static void removeInstance(final btCollisionObject obj) {
90 		instances.remove(getCPtr(obj));
91 	}
92 
93 	protected GdxCollisionObjectBridge gdxBridge;
94 	protected int userValue;
95 	protected int contactCallbackFlag = 1;
96 	protected int contactCallbackFilter;
97 	protected btCollisionShape collisionShape;
98 
99 	/** User definable data, not used by Bullet itself. */
100 	public Object userData;
101 
102 	@Override
construct()103 	protected void construct() {
104 		super.construct();
105 		gdxBridge = new GdxCollisionObjectBridge();
106 		internalSetGdxBridge(gdxBridge);
107 		addInstance(this);
108 	}
109 
110 	@Override
dispose()111 	public void dispose() {
112 		if (swigCPtr != 0)
113 			removeInstance(this);
114 		if (gdxBridge != null)
115 			gdxBridge.dispose();
116 		gdxBridge = null;
117 		if (collisionShape != null)
118 			collisionShape.release();
119 		collisionShape = null;
120 		super.dispose();
121 	}
122 
123 	/** @return A user definable value set using {@link #setUserValue(int)}, intended to quickly identify the collision object */
getUserValue()124 	public int getUserValue() {
125 		return userValue;
126 	}
127 
128 	/** @param value A user definable value which allows you to quickly identify this collision object. Some frequently called
129 	 * methods rather return this value than the collision object itself to minimize JNI overhead. */
setUserValue(int value)130 	public void setUserValue(int value) {
131 		gdxBridge.setUserValue(userValue = value);
132 	}
133 
134 	/** @return The flag (defaults to 1) used to filter contact callbacks with this object */
getContactCallbackFlag()135 	public int getContactCallbackFlag() {
136 		return contactCallbackFlag;
137 	}
138 
139 	/** @param flag The new flag used to filter contact callbacks with this object */
setContactCallbackFlag(int flag)140 	public void setContactCallbackFlag(int flag) {
141 		gdxBridge.setContactCallbackFlag(contactCallbackFlag = flag);
142 	}
143 
144 	/** @return The filter (default to 0) that is used to match the flag of the other object for a contact callback to be triggered */
getContactCallbackFilter()145 	public int getContactCallbackFilter() {
146 		return contactCallbackFilter;
147 	}
148 
149 	/** @param filter The new filter that is used to match the flag of the other object for a contact callback to be triggered */
setContactCallbackFilter(int filter)150 	public void setContactCallbackFilter(int filter) {
151 		gdxBridge.setContactCallbackFilter(contactCallbackFilter = filter);
152 	}
153 
setCollisionShape(btCollisionShape shape)154 	public void setCollisionShape(btCollisionShape shape) {
155 		refCollisionShape(shape);
156 		internalSetCollisionShape(shape);
157 	}
158 
refCollisionShape(btCollisionShape shape)159 	protected void refCollisionShape(btCollisionShape shape) {
160 		if (collisionShape == shape)
161 			return;
162 		if (collisionShape != null)
163 			collisionShape.release();
164 		collisionShape = shape;
165 		collisionShape.obtain();
166 	}
167 
getCollisionShape()168 	public btCollisionShape getCollisionShape() {
169 		return collisionShape;
170 	}
171 
mergesSimulationIslands()172   public boolean mergesSimulationIslands() {
173     return CollisionJNI.btCollisionObject_mergesSimulationIslands(swigCPtr, this);
174   }
175 
getAnisotropicFriction()176   public Vector3 getAnisotropicFriction() {
177 	return CollisionJNI.btCollisionObject_getAnisotropicFriction__SWIG_0(swigCPtr, this);
178 }
179 
setAnisotropicFriction(Vector3 anisotropicFriction, int frictionMode)180   public void setAnisotropicFriction(Vector3 anisotropicFriction, int frictionMode) {
181     CollisionJNI.btCollisionObject_setAnisotropicFriction__SWIG_0(swigCPtr, this, anisotropicFriction, frictionMode);
182   }
183 
setAnisotropicFriction(Vector3 anisotropicFriction)184   public void setAnisotropicFriction(Vector3 anisotropicFriction) {
185     CollisionJNI.btCollisionObject_setAnisotropicFriction__SWIG_1(swigCPtr, this, anisotropicFriction);
186   }
187 
hasAnisotropicFriction(int frictionMode)188   public boolean hasAnisotropicFriction(int frictionMode) {
189     return CollisionJNI.btCollisionObject_hasAnisotropicFriction__SWIG_0(swigCPtr, this, frictionMode);
190   }
191 
hasAnisotropicFriction()192   public boolean hasAnisotropicFriction() {
193     return CollisionJNI.btCollisionObject_hasAnisotropicFriction__SWIG_1(swigCPtr, this);
194   }
195 
setContactProcessingThreshold(float contactProcessingThreshold)196   public void setContactProcessingThreshold(float contactProcessingThreshold) {
197     CollisionJNI.btCollisionObject_setContactProcessingThreshold(swigCPtr, this, contactProcessingThreshold);
198   }
199 
getContactProcessingThreshold()200   public float getContactProcessingThreshold() {
201     return CollisionJNI.btCollisionObject_getContactProcessingThreshold(swigCPtr, this);
202   }
203 
isStaticObject()204   public boolean isStaticObject() {
205     return CollisionJNI.btCollisionObject_isStaticObject(swigCPtr, this);
206   }
207 
isKinematicObject()208   public boolean isKinematicObject() {
209     return CollisionJNI.btCollisionObject_isKinematicObject(swigCPtr, this);
210   }
211 
isStaticOrKinematicObject()212   public boolean isStaticOrKinematicObject() {
213     return CollisionJNI.btCollisionObject_isStaticOrKinematicObject(swigCPtr, this);
214   }
215 
hasContactResponse()216   public boolean hasContactResponse() {
217     return CollisionJNI.btCollisionObject_hasContactResponse(swigCPtr, this);
218   }
219 
btCollisionObject()220   public btCollisionObject() {
221     this(CollisionJNI.new_btCollisionObject(), true);
222   }
223 
internalSetCollisionShape(btCollisionShape collisionShape)224   private void internalSetCollisionShape(btCollisionShape collisionShape) {
225     CollisionJNI.btCollisionObject_internalSetCollisionShape(swigCPtr, this, btCollisionShape.getCPtr(collisionShape), collisionShape);
226   }
227 
internalGetCollisionShape()228   private btCollisionShape internalGetCollisionShape() {
229     long cPtr = CollisionJNI.btCollisionObject_internalGetCollisionShape__SWIG_0(swigCPtr, this);
230     return (cPtr == 0) ? null : btCollisionShape.newDerivedObject(cPtr, false);
231   }
232 
setIgnoreCollisionCheck(btCollisionObject co, boolean ignoreCollisionCheck)233   public void setIgnoreCollisionCheck(btCollisionObject co, boolean ignoreCollisionCheck) {
234     CollisionJNI.btCollisionObject_setIgnoreCollisionCheck(swigCPtr, this, btCollisionObject.getCPtr(co), co, ignoreCollisionCheck);
235   }
236 
checkCollideWithOverride(btCollisionObject co)237   public boolean checkCollideWithOverride(btCollisionObject co) {
238     return CollisionJNI.btCollisionObject_checkCollideWithOverride(swigCPtr, this, btCollisionObject.getCPtr(co), co);
239   }
240 
internalGetExtensionPointer()241   public long internalGetExtensionPointer() {
242     return CollisionJNI.btCollisionObject_internalGetExtensionPointer(swigCPtr, this);
243   }
244 
internalSetExtensionPointer(long pointer)245   public void internalSetExtensionPointer(long pointer) {
246     CollisionJNI.btCollisionObject_internalSetExtensionPointer(swigCPtr, this, pointer);
247   }
248 
getActivationState()249   public int getActivationState() {
250     return CollisionJNI.btCollisionObject_getActivationState(swigCPtr, this);
251   }
252 
setActivationState(int newState)253   public void setActivationState(int newState) {
254     CollisionJNI.btCollisionObject_setActivationState(swigCPtr, this, newState);
255   }
256 
setDeactivationTime(float time)257   public void setDeactivationTime(float time) {
258     CollisionJNI.btCollisionObject_setDeactivationTime(swigCPtr, this, time);
259   }
260 
getDeactivationTime()261   public float getDeactivationTime() {
262     return CollisionJNI.btCollisionObject_getDeactivationTime(swigCPtr, this);
263   }
264 
forceActivationState(int newState)265   public void forceActivationState(int newState) {
266     CollisionJNI.btCollisionObject_forceActivationState(swigCPtr, this, newState);
267   }
268 
activate(boolean forceActivation)269   public void activate(boolean forceActivation) {
270     CollisionJNI.btCollisionObject_activate__SWIG_0(swigCPtr, this, forceActivation);
271   }
272 
activate()273   public void activate() {
274     CollisionJNI.btCollisionObject_activate__SWIG_1(swigCPtr, this);
275   }
276 
isActive()277   public boolean isActive() {
278     return CollisionJNI.btCollisionObject_isActive(swigCPtr, this);
279   }
280 
setRestitution(float rest)281   public void setRestitution(float rest) {
282     CollisionJNI.btCollisionObject_setRestitution(swigCPtr, this, rest);
283   }
284 
getRestitution()285   public float getRestitution() {
286     return CollisionJNI.btCollisionObject_getRestitution(swigCPtr, this);
287   }
288 
setFriction(float frict)289   public void setFriction(float frict) {
290     CollisionJNI.btCollisionObject_setFriction(swigCPtr, this, frict);
291   }
292 
getFriction()293   public float getFriction() {
294     return CollisionJNI.btCollisionObject_getFriction(swigCPtr, this);
295   }
296 
setRollingFriction(float frict)297   public void setRollingFriction(float frict) {
298     CollisionJNI.btCollisionObject_setRollingFriction(swigCPtr, this, frict);
299   }
300 
getRollingFriction()301   public float getRollingFriction() {
302     return CollisionJNI.btCollisionObject_getRollingFriction(swigCPtr, this);
303   }
304 
getInternalType()305   public int getInternalType() {
306     return CollisionJNI.btCollisionObject_getInternalType(swigCPtr, this);
307   }
308 
getWorldTransform()309   public Matrix4 getWorldTransform() {
310 	return CollisionJNI.btCollisionObject_getWorldTransform__SWIG_0(swigCPtr, this);
311 }
312 
setWorldTransform(Matrix4 worldTrans)313   public void setWorldTransform(Matrix4 worldTrans) {
314     CollisionJNI.btCollisionObject_setWorldTransform(swigCPtr, this, worldTrans);
315   }
316 
getBroadphaseHandle()317   public btBroadphaseProxy getBroadphaseHandle() {
318 	return btBroadphaseProxy.internalTemp(CollisionJNI.btCollisionObject_getBroadphaseHandle__SWIG_0(swigCPtr, this), false);
319 }
320 
setBroadphaseHandle(btBroadphaseProxy handle)321   public void setBroadphaseHandle(btBroadphaseProxy handle) {
322     CollisionJNI.btCollisionObject_setBroadphaseHandle(swigCPtr, this, btBroadphaseProxy.getCPtr(handle), handle);
323   }
324 
getInterpolationWorldTransform()325   public Matrix4 getInterpolationWorldTransform() {
326 	return CollisionJNI.btCollisionObject_getInterpolationWorldTransform__SWIG_0(swigCPtr, this);
327 }
328 
setInterpolationWorldTransform(Matrix4 trans)329   public void setInterpolationWorldTransform(Matrix4 trans) {
330     CollisionJNI.btCollisionObject_setInterpolationWorldTransform(swigCPtr, this, trans);
331   }
332 
setInterpolationLinearVelocity(Vector3 linvel)333   public void setInterpolationLinearVelocity(Vector3 linvel) {
334     CollisionJNI.btCollisionObject_setInterpolationLinearVelocity(swigCPtr, this, linvel);
335   }
336 
setInterpolationAngularVelocity(Vector3 angvel)337   public void setInterpolationAngularVelocity(Vector3 angvel) {
338     CollisionJNI.btCollisionObject_setInterpolationAngularVelocity(swigCPtr, this, angvel);
339   }
340 
getInterpolationLinearVelocity()341   public Vector3 getInterpolationLinearVelocity() {
342 	return CollisionJNI.btCollisionObject_getInterpolationLinearVelocity__SWIG_0(swigCPtr, this);
343 }
344 
getInterpolationAngularVelocity()345   public Vector3 getInterpolationAngularVelocity() {
346 	return CollisionJNI.btCollisionObject_getInterpolationAngularVelocity__SWIG_0(swigCPtr, this);
347 }
348 
getIslandTag()349   public int getIslandTag() {
350     return CollisionJNI.btCollisionObject_getIslandTag(swigCPtr, this);
351   }
352 
setIslandTag(int tag)353   public void setIslandTag(int tag) {
354     CollisionJNI.btCollisionObject_setIslandTag(swigCPtr, this, tag);
355   }
356 
getCompanionId()357   public int getCompanionId() {
358     return CollisionJNI.btCollisionObject_getCompanionId(swigCPtr, this);
359   }
360 
setCompanionId(int id)361   public void setCompanionId(int id) {
362     CollisionJNI.btCollisionObject_setCompanionId(swigCPtr, this, id);
363   }
364 
getHitFraction()365   public float getHitFraction() {
366     return CollisionJNI.btCollisionObject_getHitFraction(swigCPtr, this);
367   }
368 
setHitFraction(float hitFraction)369   public void setHitFraction(float hitFraction) {
370     CollisionJNI.btCollisionObject_setHitFraction(swigCPtr, this, hitFraction);
371   }
372 
getCollisionFlags()373   public int getCollisionFlags() {
374     return CollisionJNI.btCollisionObject_getCollisionFlags(swigCPtr, this);
375   }
376 
setCollisionFlags(int flags)377   public void setCollisionFlags(int flags) {
378     CollisionJNI.btCollisionObject_setCollisionFlags(swigCPtr, this, flags);
379   }
380 
getCcdSweptSphereRadius()381   public float getCcdSweptSphereRadius() {
382     return CollisionJNI.btCollisionObject_getCcdSweptSphereRadius(swigCPtr, this);
383   }
384 
setCcdSweptSphereRadius(float radius)385   public void setCcdSweptSphereRadius(float radius) {
386     CollisionJNI.btCollisionObject_setCcdSweptSphereRadius(swigCPtr, this, radius);
387   }
388 
getCcdMotionThreshold()389   public float getCcdMotionThreshold() {
390     return CollisionJNI.btCollisionObject_getCcdMotionThreshold(swigCPtr, this);
391   }
392 
getCcdSquareMotionThreshold()393   public float getCcdSquareMotionThreshold() {
394     return CollisionJNI.btCollisionObject_getCcdSquareMotionThreshold(swigCPtr, this);
395   }
396 
setCcdMotionThreshold(float ccdMotionThreshold)397   public void setCcdMotionThreshold(float ccdMotionThreshold) {
398     CollisionJNI.btCollisionObject_setCcdMotionThreshold(swigCPtr, this, ccdMotionThreshold);
399   }
400 
getUserPointer()401   public long getUserPointer() {
402     return CollisionJNI.btCollisionObject_getUserPointer(swigCPtr, this);
403   }
404 
getUserIndex()405   public int getUserIndex() {
406     return CollisionJNI.btCollisionObject_getUserIndex(swigCPtr, this);
407   }
408 
setUserPointer(long userPointer)409   public void setUserPointer(long userPointer) {
410     CollisionJNI.btCollisionObject_setUserPointer(swigCPtr, this, userPointer);
411   }
412 
setUserIndex(int index)413   public void setUserIndex(int index) {
414     CollisionJNI.btCollisionObject_setUserIndex(swigCPtr, this, index);
415   }
416 
getUpdateRevisionInternal()417   public int getUpdateRevisionInternal() {
418     return CollisionJNI.btCollisionObject_getUpdateRevisionInternal(swigCPtr, this);
419   }
420 
checkCollideWith(btCollisionObject co)421   public boolean checkCollideWith(btCollisionObject co) {
422     return CollisionJNI.btCollisionObject_checkCollideWith(swigCPtr, this, btCollisionObject.getCPtr(co), co);
423   }
424 
calculateSerializeBufferSize()425   public int calculateSerializeBufferSize() {
426     return CollisionJNI.btCollisionObject_calculateSerializeBufferSize(swigCPtr, this);
427   }
428 
serialize(long dataBuffer, SWIGTYPE_p_btSerializer serializer)429   public String serialize(long dataBuffer, SWIGTYPE_p_btSerializer serializer) {
430     return CollisionJNI.btCollisionObject_serialize(swigCPtr, this, dataBuffer, SWIGTYPE_p_btSerializer.getCPtr(serializer));
431   }
432 
serializeSingleObject(SWIGTYPE_p_btSerializer serializer)433   public void serializeSingleObject(SWIGTYPE_p_btSerializer serializer) {
434     CollisionJNI.btCollisionObject_serializeSingleObject(swigCPtr, this, SWIGTYPE_p_btSerializer.getCPtr(serializer));
435   }
436 
internalSetGdxBridge(GdxCollisionObjectBridge bridge)437   private void internalSetGdxBridge(GdxCollisionObjectBridge bridge) {
438     CollisionJNI.btCollisionObject_internalSetGdxBridge(swigCPtr, this, GdxCollisionObjectBridge.getCPtr(bridge), bridge);
439   }
440 
internalGetGdxBridge()441   private GdxCollisionObjectBridge internalGetGdxBridge() {
442     long cPtr = CollisionJNI.btCollisionObject_internalGetGdxBridge(swigCPtr, this);
443     return (cPtr == 0) ? null : new GdxCollisionObjectBridge(cPtr, false);
444   }
445 
getAnisotropicFriction(Vector3 out)446   public void getAnisotropicFriction(Vector3 out) {
447     CollisionJNI.btCollisionObject_getAnisotropicFriction__SWIG_1(swigCPtr, this, out);
448   }
449 
getWorldTransform(Matrix4 out)450   public void getWorldTransform(Matrix4 out) {
451     CollisionJNI.btCollisionObject_getWorldTransform__SWIG_2(swigCPtr, this, out);
452   }
453 
getInterpolationWorldTransform(Matrix4 out)454   public void getInterpolationWorldTransform(Matrix4 out) {
455     CollisionJNI.btCollisionObject_getInterpolationWorldTransform__SWIG_2(swigCPtr, this, out);
456   }
457 
getInterpolationLinearVelocity(Vector3 out)458   public void getInterpolationLinearVelocity(Vector3 out) {
459     CollisionJNI.btCollisionObject_getInterpolationLinearVelocity__SWIG_1(swigCPtr, this, out);
460   }
461 
getInterpolationAngularVelocity(Vector3 out)462   public void getInterpolationAngularVelocity(Vector3 out) {
463     CollisionJNI.btCollisionObject_getInterpolationAngularVelocity__SWIG_1(swigCPtr, this, out);
464   }
465 
466   public final static class CollisionFlags {
467     public final static int CF_STATIC_OBJECT = 1;
468     public final static int CF_KINEMATIC_OBJECT = 2;
469     public final static int CF_NO_CONTACT_RESPONSE = 4;
470     public final static int CF_CUSTOM_MATERIAL_CALLBACK = 8;
471     public final static int CF_CHARACTER_OBJECT = 16;
472     public final static int CF_DISABLE_VISUALIZE_OBJECT = 32;
473     public final static int CF_DISABLE_SPU_COLLISION_PROCESSING = 64;
474   }
475 
476   public final static class CollisionObjectTypes {
477     public final static int CO_COLLISION_OBJECT = 1;
478     public final static int CO_RIGID_BODY = 2;
479     public final static int CO_GHOST_OBJECT = 4;
480     public final static int CO_SOFT_BODY = 8;
481     public final static int CO_HF_FLUID = 16;
482     public final static int CO_USER_TYPE = 32;
483     public final static int CO_FEATHERSTONE_LINK = 64;
484   }
485 
486   public final static class AnisotropicFrictionFlags {
487     public final static int CF_ANISOTROPIC_FRICTION_DISABLED = 0;
488     public final static int CF_ANISOTROPIC_FRICTION = 1;
489     public final static int CF_ANISOTROPIC_ROLLING_FRICTION = 2;
490   }
491 
492 }
493