libgdx/libgdx — pull request #2176 by jrenner (2014-07-29 07:39:14+00:00)
Title: Bullet memory

I've been doing lots of raycasting in bullet (see: http://www.java-gaming.org/topics/fps-engine/33931/view.html) and ran into problems where the bullet wrapper was creating a lot of garbage when getting raycast ray positions and hit normals due to btVector3 new object allocation.

It's currently not possible to get the hit normals without creating a new btVector3 java object. So I have implemented a static temporary object, and also made it publicly available with the appropriate java-doc warning that it is for low-level use.

Then I went through some raycast callbacks and modified their get methods to return the temporary variable.

If we don't feel good about returning the temporary variable, I'd like to keep the static btVector3.getTemp(), and then change the get methods to something like this:
```java
public btVector3 getHitNormal(btVector3 out) {
...set values and return
}
```
then it's easy enough to grab btVector3.getTemp() and pass it to the method.

Both solutions solve my garbage collection problem.

@xoppa, let me know what you think.