Rotate From SpawnPoint TO Transform Rotation

Hello Everyone

i Got Problem With Shooting Bullet

its shoot from the spawnPoint [Weapon] To Forward

i actually need it to shoot from SpawnPoint To Forward but with rotate

Lemme Show You This Photo, Might Explain Better

//So In Instantiate i use
SpawnPoint.rotation

//i should changed it and make to go to the center

alt text

1 Answer

1

As with any mouse position, you have to convert the 2D coordinate into one in 3D space by specifying a Z distance in front of the camera for the point, but works the same way no matter where the camera faces:

function Update() {
    var v3 = Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane);
    v3 = Camera.main.ScreenToWorldPoint(v3);
    Debug.DrawLine(transform.position, v3, Color.green);
}

sry i guess question totally changed :) ur Code Helpfull! +1

umm,, we cant just do the CrossHair then i will make the bullet at crosshair Transform Forward