Hello, im very new in comparison to alot of the people here.
prepare for some turbo-noob question.
Having troubles with 2D and i believe my solution involves ScreenToWorldPoint.
I for the most part know what i want to write to create a weapon that orbits my character, which rotates towards the cursor.
Currently having a bit of confusion..
For WASD And Spacebar I have been using Input.GetKeyDown(KeyCode.Space)
and the inputmanager
Looking for a really simple and short way to capture a screen position under the mouse-cursor into a Vector2!
my solution that DID not work was:
private WeaponParent weaponParent;
[SerializeField]
private InputActionReference movement, attack, pointerPosition;
void Start()
{
weaponParent = GetComponentInChildren<WeaponParent>();
}
pointerInput = GetPointerInput();
weaponParent.PointerPosition = pointerInput;
private Vector2 GetPointerInput(){ ///bs for pointer
Vector3 mousePos = pointerPosition.action.ReadValue<Vector2>();
mousePos.z = Camera.main.nearClipPlane;
return Camera.main.ScreenToWorldPoint(mousePos); ///who tf is screen to world and why are they pointing
}
and subsequently when adding this code to my script my character can no longer move.