I have an airship in my game that moves in a circle using forces. The problem is, my Character Control doesn’t move with it. Here is what I have so far:
Vector3f loc = ((Node)world.getChild("airship")).getControl(RigidBodyControl.class).getPhysicsLocation();
Vector3f offset = loc.subtract(player.getPhysicsLocation());
player.warp(loc.add(offset.add(new Vector3f(0, 6.5f, 0))));
And then if I don’t add (0, 6.5f, 0), the airship careens off to the side, but the character still doesn’t move Can someone tell me what is wrong?
So is the character just not warping? I assume the character walks around on top of the ship, as though its a platform (or is supposed to)?
The character walks around the ship, but when It’s not walking the ship moves from under it. Then it falls off the edge.
Is this question really that hard to answer? I made some progress, but not without breaking everything else. I just need some example code to study off of.
When the character is not walking the ship slides from under it, so you are warping it to make it follow the ship right? Does the warping not change the players position?
I dont know if I am helping with this, but I saw other post from long time a go with exactly the same problem, the guy has an spaceship and player walking inside the ship, but gets problems when the ship moves. He fix it but I dont remember how, but you can maybe try to find his post.
This sounds like a world space issue, as if both the ship and character were attached to the rootNode. Try attaching a node to the airship, and than the character to that node. This way your character moves in relation to the ship, not the world
Exactly. t’s almost as if the warp function doesn’t work.
I can’t do that because the character is supposed to be able to walk off the ship. Actually, you just gave me an idea that may just work. I’ll post back the results when I try it.
Never mind. My original idea didn’t work, but I have something going. I just need to fine tune it.
K well keep us updated. Suspicious about warp not working
I found out that warp is in fact working, but the way I was calculating where the character should be was totally wrong. I had to multiply my offset vector so that it isn’t zeroed out somehow. I just have to find that magic number. I’ll post the code when I figure it out, right after I get the SDK to cooperate with me for once.