Camera watching inbetween the player and cursor

Hello everyone!

I have a question regarding player camera/controls, which involves the camera to look at the middle point between the player and the cursor like this: -----X----- and how to make the player look at the cursor but when moving to ignore moving towards the cursor.

So my 2 Questions are this:
What can I put into my code to make it so my camera focus’ in between my player and the cursor and show a prefab at the cursor location?

How can I make the player look at the cursor but ignore moving towards it?

Here is my code for moving:

using UnityEngine;
using System.Collections;

public class Controller:MonoBehaviour

	public float MoveSpeed;
	public float RotationSpeed;
	CharacterController cc;

	void Start()

	void Update()
		Vector3 forward = Input.GetAxis ("Vertical") * transform.TransformDirection (Vector3.forward) * MoveSpeed;
		transform.Rotate(new Vector3(0,Input.GetAxis("Horizontal") * RotationSpeed * Time.deltaTime,0));
		cc.Move (forward * Time.deltaTime);

To get the middlepoint of vectors, you need to add each vector position and then devide by the amount of vector positions, for you this would be
Vector3 midPoint = (player.transform.position + mouseWorldPos) / 2;

For the mouse position in world space, take a look [here][1].

For something to look at a certain point, unity has a nice build-in function:


Make sure the forward of the object is correct, you can always change that.

Now for the charactercontroller to do a motion so it wont move towards the camera, you could give the motion a spin of lets say 90 degrees before executing it (just an idea I hope im not wrong).

To do so, use:

Quaternion.euler(new Vector3(0, 90, 0)) * <your motion(vector3)>;

Make sure to put the quaternion on the left side of the “times * thing”, if you switch both the quaternion and vector3 from side itll trow an error.

Sorry for the not so perfect english. I also didnt check for compile errors since im on my phone. Anyways, I hope i helped you somewhat!
[1]: Unity - Scripting API: Camera.ScreenToWorldPoint