How to constrain a physics space to calculate only x/y or any 2 axis-es. Ignoring another one.
something like this video.
http://www.youtube.com/watch?v=wLpEcl-33IA
.
Not possible just like that with jbullet, setAngularFactor is a singular float and not a Vector like in native bullet, people tried this in various ways, basically applying counter-forces, just look in the forum. (and no, its also not available in the native bullet wrapper as its 1:1 with the jbullet version as long as that is the default implementation)
The solution would be creating 2 invisible physics walls with the stones between it.
Hey, I’m curious, how was the moto cross jme game made then?
I think it didn’t have “real” physics… But if it did, jME2 was using ODE, maybe there was some option to do 2d physics, I never got far with it though, it frequently crashed…
it’s really 2D -.-
well, its those controllers. You attach your mesh to those. There is no way to ignore the extra d in jBullet.
@iamcreasy : This was discussed here (you even commented to that post ):http://hub.jmonkeyengine.org/groups/physics/forum/topic/lock-z-axis/[java]@Override
public void prePhysicsTick(PhysicsSpace space, float f){
Vector3f linearVelocityVector = getLinearVelocity();
Vector3f angularVelocityVector = getAngularVelocity();
linearVelocityVector.z = 0;
angularVelocityVector.x = 0;
angularVelocityVector.y = 0;
setLinearVelocity(linearVelocityVector);
setAngularVelocity(angularVelocityVector);
}[/java] ended up working for mt4x, sounds like this is exactly what you want.
An integration of jBox2d or another 2d physics library for jme3 would be cool though It would save quite a lot of computational costs removing one dimension.
yes, I remember that thread
As said, when we use native bullet by default (or maybe if jbullet adds it, I didn’t sync with jezeks version for long, he’s not very cooperative…) we can constrain both rotation and movement in three dimensions. Any kind of add-on library is welcome though if done the jme3 way
@normen said:
As said, when we use native bullet by default we can constrain both rotation and movement in three dimensions.
Cool:) Does this mean that it's not at all computed or that it's just constrained?
It doesn’t make such a great difference as it sounds but the axis would “just” be multiplied with the given factor, so its “constrained”.