Need help how to determine which way "right" is

I’m trying to create a “2d” fighting game in a 3d world (where the camera angle can change and the “rotation” of left/right can change)… eg +x isn’t always going to be right or anything like that

Both players are already confgured to be “facing” eachother (with charactercontrol.setViewDirection())… Now I need to make it so they can walk towards and away from eachother. I feel like this should be most easily done by using the view direction vector to determine “forward and backward”… however in order to do this I also need to know which way is left/right (which is based on the camera location)…

I just can’t figure out how to take the camera’s position (and possibly also the rotation?) and use it to determine if that when the player pushes RIGHT that the character should move in view_direction or view_direction.clone()

Here is the code I have so far…

[java]
private Vector3f getDirectionToSecondSpatial() {
Vector3f direction = secondSpatial_physics_control.getPhysicsLocation().subtract(physics_control.getPhysicsLocation());
direction.y = 0;
direction.normalizeLocal();
return direction;
}

public void controlUpdate(float tpf) {

Vector3f view_direction = getDirectionToSecondSpatial();
physics_control.setViewDirection(view_direction);

                            Vector3f cam_loc = camera.getLocation();

                            Vector3f my_location = physics_control.getPhysicsLocation(); //somehow use this to determine which way is right?
                           


                            WalkDirection walk_direction = input_control.getWalkDirectionFlag();

                            switch (walk_direction) {
                                    case Left:
                                            walk_direction_mult_speed = view_direction.negate();  // THis is the kind of concept I'm trying ot achieve. but this isn't exactly what I want.
                                            break;
                                    case Right:
                                            walk_direction_mult_speed = view_direction.clone();
                                            break;
                                    case Idle:
                                    default:
                                            walk_direction_mult_speed = Vector3f.ZERO.clone();
                                            break;
                            }

                            walk_direction_mult_speed.multLocal(this.walkForewardSpeed);
                            physics_control.setWalkDirection(walk_direction_mult_speed);

}

[/java]

THats the gyst of what I’m trying to do. just using the view_direction vector isn’t what I want. I want the player to walk along that vector but use the camera’s location to determine which direction…

I’ve been toying with it. THis is the closest I’ve gotten so far. It sort of works though theres certain placements where left/right are wrong… but this is sort of what I’m going for…

I feel like theres some math I can do to quickly calculate this… but I guess my limited knowledge of math is really hurting me here…

[java]
switch (walk_direction) {
case Left:
walk_direction_mult_speed = camera.getDirection().project(view_direction);
walk_direction_mult_speed.y = 0;
walk_direction_mult_speed.normalizeLocal();

                                            break;
                                    case Right:
                                            walk_direction_mult_speed = camera.getDirection().project(view_direction);
                                            walk_direction_mult_speed.y = 0;
                                            walk_direction_mult_speed.normalizeLocal().negateLocal();
                                            break;
                                    case Idle:
                                    default:
                                            walk_direction_mult_speed = Vector3f.ZERO.clone();
                                            break;
                            }

[/java]

Proper function to use is cross product. You need to do cross product between ‘forward’ and ‘up’ - you will then get right or left (negate the vector to get other one).

You have a convenient camera.getLeft() method.
right is left.mult(-1)

thanks for your help guys. I was able to do it using camera.getLeft().