I implemented a dice with physics, the problem is that i don´t know identify the face of the box is up, and can´t take the value, any suggestions for know distin the position of the faces, please? (sorry for my bad english).
just check for the rotation and apply that to the normal that you want?
[java]Vector3f zNormal = rigidBody.getPhysicsRotation().mult(Vector3f.UNIT_Z);[/java]
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math_for_dummies
thanks for responding. I will read carefully the tutorial “Math for dummies”. I will try to fix it, thanks again!
Something like this,
After that just test wich one is pointing upwards (or downwards) (or at lest mostly, since you wont get a exact 0,1,0 or so, so go for the closest match), and you know wich side it is.
(feed it with the physics rotation)
(also make sure that the store is either null, or the vector it would be, this is important in this case)
public static Vector3f getRight(final Quaternion rotation,Vector3f store) {
if(store == null){
store = new Vector3f(1,0,0);
}
return rotation.mult(store);
}
public static Vector3f getUp(final Quaternion rotation,Vector3f store) {
if(store == null){
store = new Vector3f(0,1,0);
}
return rotation.mult(store);
}
public static Vector3f getForward(final Quaternion rotation) {
if(store == null){
store = new Vector3f(0,0,1);
}
return rotation.mult(store);
}
Empire Phoenix!!!
many thanks, now you’re my best friend really appreciate it
Hello again, I am researching the methods that says “Empire Phoenix”, but I still don´t know what is face up when I throw the dice … (I think I’m obfuscated)
this is the source code : https://dl.dropbox.com/u/22447604/BasicGame.rar
Any suggestions or help, please? Thanks for your patience