Orientation issues

Hey,



I’d need a hand on how to code something. Here is the context: I have a character (a RigidBodyControl item) sliding freely on a platform (let’s imagine that this is an ice platform, I set the friction to almost 0) and the player makes the character move by rolling/pitching/yawing the platform.



The fact is that so far, I managed to make my character slide but the problem is that it doesn’t rotate according to the movement (it’s sliding like a crab).



First I thought that I would add a small mass on the forward of the character so it makes it rotate but I couldn’t manage to do so, so I kinda droped this idea.



Then I thought I could update the orientation of the item manually but as it’s a physics item, I encountered some weird behaviors using rotations on it.



So here I am, I’d like to know if you guys see a solution to solve this problem efficiently.



Note: my camera is an overall camera that looks at the platform center from above (with an approximate angle of 45°).

What do you think the setViewDirection() method does, hm?

I don’t have such a method neither in my physics methods or in my spatial ones. And I can’t find it by searching the forum or wiki. Is this method applying to RigidBodyControl’s or Spatial’s ?



Edit: I found it into the source code, but it appears to be a CharacterControl method. My title may be confusing but i meant my main character (which is a RigidBodyControl), not a CharacterControl (I made some changes in the topic so it won’t be confusing anymore).

You use a RigidBody for a character? Why don’t you use a character? Anyway, how does the object stay in place? You should set it to kinematic mode if you want to use it as a character and then the rotation of the object its attached to will also be updated accordingly. If you just set its mass to zero you didnt read the tutorial and manual obviously.

Nah it can’t be that way cause I need my character not to be kinematic. The player is not actually moving the character but the platfom. Like in “Labyrinth”… let’s say that my character is the ball and the platform is the labyrinth but instead of a ball I have a character that has to update its direction according to the platform orientation (so it feels real).

If I put the character to kinematic, then I have to implement all its moves and it won’t be as real as if I keep it not kinematic and let the physic calculate its moves.

My game is like having an ice cube on a plane and the player has to move the plane to make the ice cube move.



Then my main problem is that, it seems that from the time you set your item to “not kinematic”, none of the methods like “setLocalRotation” work. I also tried using methods like “applyForce” to make my item turn around but there is no way it works.

There is no other way to move a non-kinematic rigidbody but by using applyforce. If you dont want physics, dont use it. If you move the physics object by setLocalTranslation() and -Rotation() its like you beam the object around, thats not physics. Moving a zero-mass object is sure to cause wrong physics too. If you want “real physics”, you will have to implement a very complex system like euphoria to make the character balance on its legs etc.



Look at the kinematic ragdoll test, its not just a ragdoll, but also a physics object that moves according to the animation of the model. That is what you should do if you want controllable animation. Then you can make it fall or be blown away by some explosion by enabling the ragdoll effect (which internally switches the libs rigidbodies from kinematic to non-kinematic).

Ok I’mma look at this but it seems so complicated for what I wanna do. I was more actually thinking about some kind of a damped recall force using the platform tilt angles as parameters.



I’mma check this all… thx, and I’m still opened to new ideas cause it seems that this problem (that I thought easy to solve) is getting more and more complex.

Maybe you are just a bit blue-eyed about game development :wink:

blue-eyed ?

s4milli4 said:
blue-eyed ?

Innocent, babies have blue eyes. Sorry, wasn't realizing I translate a german idiom here. The topic at hand is not an easy one (game development) even if jme may make it seem so ;)

Yeah I am certainly then as it is my first game development experience… I’m here to learn, this is my internship project. Every one has to start one day or another ;).

I tried to replace my RigidBodyControl by a CharacterBodyControl but when I try to use CompoundCollisionShape on it, it returns the exception: “Kinematic character nodes cannot have mesh collision shapes”. Can’t they use CompoundCollisionShape (cause it works fine with a standard shape ?