Minie CharacterControl problem

CharacterControl There is no “setMaxSlope(float)”
How steep the slopes and steps are that the character can climb without considering them an obstacle. Higher obstacles need to be jumped. Vertical height in world units.

CharacterControl.setPhysicsLocation(new Vector3f(0, 10f, 0));
ghostControl.setPhysicsLocation(new Vector3f(0, 10, 0));

The setPhysicsLocation method for both controls did not work correctly


I want to Move the position of the center point the CharacterControl and ghostControl center points, if I’m wrong, please point it out

Each CharacterControl contains a PhysicsCharacter, which provides the setMaxSlope(float) method. So you should be able to

    characterControl.getCharacter().setMaxSlope(0.6f);

I see 2 ghosts in the screenshot. Which is the one you tried to position?

What convinced you that the setPhysicsLocation() methods did not work correctly?
Did you try printing the results of getPhysicsLocation() after each setPhysicsLocation()?

Please provide the text of a physics-space dump to help me understand what your app is doing:

import jme3utilities.minie.PhysicsDumper;
//...
    new PhysicsDumper().dump(physicsSpace);
1 Like

Ok Thank you for your reply

Thank you for your help. I already know the correct usage

Maybe I misunderstood the purpose of this method


My understanding is that SetPhysicsLocation is used to adjust the origin position Maybe I misunderstood

You can see that neither CharacterControl nor ghostControl has properly wrapped the model

I need to adjust the CharacterControl and ghostControl origin positions

ghost AABB
Learn about the restrictions on ghosts from Wiki
Workaround: + Please use PhysicsSpace.sweepTest() instead, or kinematic physics objects with collision listeners.
Prepare to try this scenario

You can resolve this in 2 ways:

Either create a new Node and attach your character to that node and offset it inside the node then add CharacterControl to that node.

for example:

Node node = new Node();
node.attachChild(character);
character.move(0, -1, 0);
node.addControl(characterControl);

or, instead use a CompoundCollisionShape and add your collision shape into it with offset:

something like this:

CompoundCollisionShape compoundShape = new CompoundCollisionShape();

compoundShape.addChildShape(new CapsuleCollisionShape(), new Vector3f(0, -1, 0));

CharacterControl control = new CharacterControl(compoundShape, slope);

1 Like
 CharacterControl control = new CharacterControl(compoundShape, height);

Incompatible type: CompoundCollisionShape cannot be converted to ConvexShape

2 Likes

Oops!

Then I guess for characters you can only use the first solution.

1 Like

Yes, I usually use the first one
But the first method doesn’t completely wrap the ghost around the weapon

It’s true that a compound shape doesn’t qualify as a convex shape. However, you can create an offset capsule shape using a two-sphere MultiSphere, and that does qualify as a convex shape.

For instance:

List<Vector3f> centers = new ArrayList<>(2);
centers.add(new Vector3f(0f, 0.5f, 0f));
centers.add(new Vector3f(0f, 1.5f, 0f));
List<Float> radii = new ArrayList<>(2);
radii.add(0.5f);
radii.add(0.5f);
MultiSphere  shape = new MultiSphere(centers, radii);
1 Like

Thank you for your help

I don’t know if I did the right thing using ghosts for weapon collisions :face_with_monocle:

1 Like

There’s more than one right thing.