How do I change the origin point of a raycast?

using UnityEngine;
using System.Collections;

public class Climbing : MonoBehaviour
{
    void Update()
    {
        var rayRange = 10;
        var rayDirection = transform.TransformDirection(Vector3.forward);
        if(Physics.Raycast(transform.position + transform.up * 0.75, rayDirection, RaycastHit, rayRange))
        {
            Debug.Log("hello world");
        }
    }
}

Assets/Scripts/Climbing.cs(10,59): error CS0019: Operator *' cannot be applied to operands of type UnityEngine.Vector3’ and `double’

please help i have looked up so many tutorials but i just cant move the origin of the raycast.

Change your 0.75 to 0.75f, otherwise your code looks right for moving the ray origin 0.75 units above the object.

This will make it a float instead of a double which unity prefers (quicker calculations but less precise).

In addition to the problem @thomasindustry points out (which is the source of the error you are asking about), you are using a type where a variable should be when you use RaycastHit for the third parameter. The parameter needs to be a variable of that type, plus you need the ‘out’ keyword since the value is returned in the variable. Also when coding in C#, generally I make parameter explicit rather than use ‘var’. So here is a rewrite of your code that will compile:

using UnityEngine;
using System.Collections;

public class Climbing : MonoBehaviour
{
	void Update()
	{
		float rayRange = 10.0f;
		Vector3 rayDirection = transform.TransformDirection(Vector3.forward);
		RaycastHit hit; 
		if(Physics.Raycast(transform.position + transform.up * 0.75f, rayDirection, out hit, rayRange))
		{
			Debug.Log("hello world");
		}
	}
}