This should be very straightforward so I’m not certain why this isn’t working. I have a bullet type entity I instantiate and it moves towards the mouse position on Awake (it doesn’t update so it doesn’t follow the mouse just the initial position).
With debug.log checking I am certain that the coordinates are correct and are not changed but if my mouse is to the left of my character (and the character has turned to face that direction) the bullet instead of moving towards the mouse position flies off in a random direction (generally top of the screen) even though the ScreenToWorldPoint destination is correct. I’ve tried to do this with constant force, add force, add relative force, etc and all do the same thing.
This is such a simple problem and such simple code I must be missing something easy here right?
Void Awake() {
_mousePos = mainGame2DCamera.ScreenToWorldPoint(Input.mousePosition);
//this is definitely correct
}
void FixedUpdate() {
_localRB.AddForce(_mousePos * .5f);
}
Whoops I thought Input.mousePosition world point was already a direction. Thanks for the help.
– Silly_Rollo